1function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { 2 if (error_reporting() != 0) { 3 // report non-silenced errors 4 echo "Error: $err_no - $err_msg, $filename($linenum)\n"; 5 } 6} 7set_error_handler('test_error_handler'); 8 9 10 11class classWithToString 12{ 13 public function __toString() { 14 return "Class A object"; 15 } 16} 17 18class classWithoutToString 19{ 20} 21 22$variation_array = array( 23 'instance of classWithToString' => new classWithToString(), 24 'instance of classWithoutToString' => new classWithoutToString(), 25 );