For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2008 > object id









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author object id
Peter Pei

2008-01-07, 10:01 pm

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...


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com