3
votes
1answer
70 views

Improvement of my php code

I wrote a class with this function. Can I improve my code performance in the bottom of the function? I don't like the while loops! public function loadFields(array $fields, $as_object = ...
2
votes
1answer
37 views

Can I do something better in that code? And improvements?

Hi guys, simple question! Can I do something better with the code I wrote. It's running problem less. It's just a snippet of a library I wrote. Thank you for all answers! <?php /* * ...
1
vote
1answer
56 views

array to return on conditions

I am writing a method to find me a price range for special price as well as the retail price. Such as in example below I have price range for retail from 129 to 329 where as special price range is 89 ...
0
votes
1answer
43 views

Should a User class only contain attributes and no methods apart from getters/setters?

I'm trying to improve my OOP code and I think my User class is becoming way too fat. In my program a user has rights over "lists". Read, Write, Update, Delete. So I made a User class class User { ...
2
votes
1answer
100 views

PHP - Alternated Caesar Cipher, code could be improved?

I've recently picked up PHP and due to having an IT-security class I tried out to code the first assignment in PHP. The algorithm I took upon is an alternation of the caesar cipher, instead of using a ...
1
vote
1answer
39 views

Referring to nested arrays and array_merge (php)

In such an array: $arr = Array ( [key0] => Array ( [subkey0] => Array ( [0] => "value0" [1] => "value1" ) [subkey1] => Array ( ...
8
votes
0answers
206 views

Thoughts on my brain fart interpreter?

Had some free time this weekend and I hacked together a small Brainfuck interpreter, with the sole intention of explaining PHP's flavour of OO to a friend. This is a bit over-engineered on purpose, ...
0
votes
2answers
74 views

Image Upload Script Security Review

<?php $filename = $_FILE['inputfile']['name']; $upload_path = 'images/'; //extract extension $ext = strtolower(substr($filename, strrpos($filename, '.') + 1)); // return mime type ala mimetype ...
1
vote
1answer
50 views

How to optimize the pagination query?

This is completely optimization question, I have a pagination query like that $this->paginate = array( 'fields' => array( 'DISTINCT Contact.contact_id', ...
1
vote
0answers
53 views

Simple event mediator

I was trying to explain the mediator pattern to a new developer, and ended up writing a simple event mediator. Thoughts? EventMediator class EventMediator { private $events = array(); ...
1
vote
1answer
67 views

Suggestions for improvement of HTML table building function

User specification "var_dump($GLOBALS) is ugly as ... without wamp" General specification Produce a PHP function to display the contents of $GLOABLS in a user-friendly manner Must produce ...
9
votes
4answers
1k views

Looking at this code, would you say I'm an OK coder?

Looking at this code, would you say I'm an OK coder? I just created this during a live screencast. The people who were on there were very very very critical of almost every line of code. They say I ...
0
votes
2answers
80 views

Image upload script

Listening to mseancole's advice in my previous post, I have rewritten the code. function fihHomeIndex() { global $conf, $DBH; if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { ...
2
votes
1answer
238 views

Image upload script in PHP

Hello users of codereview, I have written a basic image upload function that handles up to five file inputs, in PHP, intended to be hosted live on the internet very soon. As far as I know it's ...
0
votes
1answer
189 views

Routing done in php

I've written a small routing system in PHP but I'm not sure if it's done the right way and what changes can they be done to the code and improvements. Thank you very much for your help and time to ...

1 2 3 4 5
15 30 50 per page