<?php
/* sample code to show use of magic methods <b>__toString()</b>.
* http://royads.blogspot.com
*/
class stringTest
{
public function __toString()
{
return 'It can\'t be echo like this';
}
}
class stringTest2
{
}
$obj = new stringTest();
echo $obj."\n\n\n";
$obj = new stringTest2();
echo $obj;
?>