3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php Class Usuario{ public $nombre; public $edad; public $enfermedades = array(); } Class Diarrea{ public $color = "cafe"; public $consistencia = "liquida"; public $olor = "apestosa"; } $Ryan = new Usuario(); $Ryan->nombre = "Ryan"; $Ryan->edad = 19; $Ryan->enfermedades[] = new Diarrea(); echo "El usuario ".$Ryan->nombre." tiene ".$Ryan->edad." años y tiene ".count($Ryan->enfermedades)." enfermedades, ".$Ryan->enfermedades[0]; ?>
based on kXm9U
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class Diarrea could not be converted to string in /in/PpuH9 on line 20
Process exited with code 255.
Output for 5.2.0 - 7.0.20
Catchable fatal error: Object of class Diarrea could not be converted to string in /in/PpuH9 on line 20
Process exited with code 255.
Output for 5.0.0 - 5.1.6
El usuario Ryan tiene 19 años y tiene 1 enfermedades, Object id #2
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/PpuH9 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/PpuH9 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/PpuH9 on line 4
Process exited with code 255.