in Hacking

Frustrating PHP 4 Objects

Today I tried the following:

function getObject()
{
$object = new Object();
return $object;
}
getObject()->executeMethod();

Well the code above works perfectly ...
All great, the app worked, so I've committed the project to Subversion.
Upload it to our production server..

Crash!
Well the production server runs PHP4.
Our development server runs PHP5.

In PHP4, You first must put the result of the method call in a variable...

$obj = getObject();
$obj->executeMethod();

*sigh* Sometimes I hate PHP!