Hi everybody.

There is an object of class City . If i write

 echo $city; 

no errors, no logging, no exceptions.

Please explain why?

 $city = new City; echo $city; 

2 answers 2

This is your error output apparently not worth it.

Code on ideone.com

  • Thank! Strangely, the vornings all go and the notes, but there's nothing at all on this thing ... - Costa
  • one
    In php ini there was one e_strict. - Costa

echo - Prints one or more lines.

To print an object, use print_r ($ city) or var_dump ($ city)

If you want via echo, then in the object you need to write a translation into a string value:

 public function __toString() { return "dsfsd"; } 
  • Thank you, I understand this, it is not clear why the error does not work, there are no entries in the logs, nothing. Although all sorts of vornings go. - Costa
  • @Costa, it is clear) the question did not quite understand it means) - IVsevolod