Posted by Peter Pei on 01/08/08 03:59
I am reading a PHP5 book for fun. The book gives the attached code, which
supposed to print object id, but throw exception in 5.2.5. I assume that
this can be resolved by defining __toString() method. My question is when
this stopped working (which version)?
<?php
class ShopProduct {
}
$product1 = new ShopProduct();
$product2 = new ShopProduct();
print "$product1\n";
print "$product2\n";
?>
Well I can use ver_dump to see id any way...
Navigation:
[Reply to this message]
|