// let's make the string 'Monday' lowercase
// in PHP
$string = 'Monday';
$string = strtolower($string);
echo $string; // echoes 'monday';
var string = 'Monday';
alert(string); // alerts 'monday';
This was when I built the string object. It wasn't complex. It didn't have to be complex. There were a few basic methods: the obvious __toString(), casing changes, length calculations, etc. After this one I moved onto more fun objects, including arrays and different number objects. The most useful one by far was the date object where I could call a simple $date->shortFormat() or $date->friendlyFormat() instead of worrying about the crazy date() format specifications or timestamp math.
To test out the system I kept all of these objects locked up on the ORM level. When I looped through a MySQLi result I would set each value to it's appropriate data type. This made for an elegant setup… values were set in data objects, rows of values within a model, and rows of models (or a full result) would be a collection. Outside of this clean setup there were a few issues, though. If I wanted to do any logic or checking I'd have to cast it down to flat variables. There is only a __toString() magic method and no __toNumber(), so I had to deal with numbers as strings or call a getValue() method. I also noticed small performance losses thanks to the extra code and files. After keeping this test system live for the better part of a year I took it down and simplified my entire ORM.
After I took out the data objects I thought a lot about what difference they had made. My code had some long-winded workarounds and had scary memory usage. I've looked a bit into the SPL library for PHP, which may have helped with the performance, but I was mostly interested in the readability and usability. It was nice to have some things like $date->getXMLDisplayFormat() instead of having to remember how RFC 822 worked, but the extra measures I had to take in other spots in the code created horrible muddy messes. If there was more functionality built into PHP to handle objects things might have turned out differently.
However, now a year later, I do miss the objects. They may have taken a bit of extra work and specialization to use, but any new technique does. Their usefulness in a large team environment would be invaluable to maintain consistency across different interfaces. They may have had their shortcomings, but for a programmer who enjoys object-orientated programming, a little bit of experimentation and extra code is worth making PHP a little less archaic.