The fifth version of the PHP: Hypertext Preprocessor (PHP) scripting language. It features the Zend Engine 2, better object model support, and many other improvements over PHP 4.

learn more… | top users | synonyms

1
vote
1answer
55 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
41 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 { ...
-1
votes
0answers
51 views

Handling external services [closed]

Our application relies on third party services. I can search for photos from Google. I can search for Videos from Youtube. I can search for Users from Facebook / Youtube etc. Our current solution is ...
0
votes
0answers
11 views

Is it acceptable for child classes to “break” parent class functionality? [migrated]

One of the devs that works with me is following the Open/Closed Principle to add functionality to a Model by extending from our framework ORM. class BaseModel extends ORM { ... } All our models ...
2
votes
1answer
90 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
38 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 ( ...
7
votes
0answers
198 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
73 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(); ...
2
votes
1answer
80 views

First steps with PHP OOP

I am learning OOP using PHP5 and I wrote two simple classes for receive data of database using dependency injection pattern and render a grid with Twig. Please, if is possible, take a look and give ...
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 ...
3
votes
3answers
287 views

Critique my first OOP attempt

I am trying to learn OOP using PHP5 and I wrote a simple MySQL connection class. Please take a look and give me some feedback on better practices, critical errors, and any other feedback you can ...
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
79 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') { ...

1 2 3 4 5 6
15 30 50 per page