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;
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;
This is your error output apparently not worth it.
Code on ideone.com
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"; }
Source: https://ru.stackoverflow.com/questions/269095/
All Articles