3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class testo{ public $valeur='oo'; public $n=''; public function __construct($valeur){ $this->valeur = $valeur; } public function setName($nam){ $this->n = $nam; } } // your code goes here $t = new testo(); $a=$t->valeur='ok'; echo $a ; $tt = new testo('ooooh'); echo $tt ;
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function testo::__construct(), 0 passed in /in/TIn9f on line 25 and exactly 1 expected in /in/TIn9f:8 Stack trace: #0 /in/TIn9f(25): testo->__construct() #1 {main} thrown in /in/TIn9f on line 8
Process exited with code 255.
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 1 for testo::__construct(), called in /in/TIn9f on line 25 and defined in /in/TIn9f on line 8 Notice: Undefined variable: valeur in /in/TIn9f on line 10 ok Catchable fatal error: Object of class testo could not be converted to string in /in/TIn9f on line 30
Process exited with code 255.
Output for hhvm-3.12.0
Warning: __construct() expects exactly 1 parameter, 0 given in /in/TIn9f on line 10 Notice: Undefined variable: valeur in /in/TIn9f on line 10 ok Fatal error: Uncaught Error: Object of class testo could not be converted to string in /in/TIn9f:30 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Warning: __construct() expects exactly 1 parameter, 0 given in /in/TIn9f on line 10 Notice: Undefined variable: valeur in /in/TIn9f on line 10 ok Catchable fatal error: Object of class testo could not be converted to string in /in/TIn9f on line 30
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Warning: Missing argument 1 for testo::__construct(), called in /in/TIn9f on line 25 and defined in /in/TIn9f on line 8 Notice: Undefined variable: valeur in /in/TIn9f on line 10 okObject id #2
Output for 5.0.0 - 5.0.5
Warning: Missing argument 1 for testo::__construct() in /in/TIn9f on line 8 okObject 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/TIn9f 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/TIn9f 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/TIn9f on line 4
Process exited with code 255.