3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ //$x; } function foo($p){ $p->x +=3; } function foo2($p){ $p->x +=1; return $p->x -1; } $a = new A(); $a->x =1; foo($a); $a->x = foo2($a); echo $a-x;
Output for 7.2.0
Warning: Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) in /in/c9o7A on line 22 Notice: Object of class A could not be converted to int in /in/c9o7A on line 22 Warning: A non-numeric value encountered in /in/c9o7A on line 22 1
Output for 7.1.0 - 7.1.10
Notice: Use of undefined constant x - assumed 'x' in /in/c9o7A on line 22 Notice: Object of class A could not be converted to int in /in/c9o7A on line 22 Warning: A non-numeric value encountered in /in/c9o7A on line 22 1
Output for 5.3.19 - 7.0.20
Notice: Use of undefined constant x - assumed 'x' in /in/c9o7A on line 22 Notice: Object of class A could not be converted to int in /in/c9o7A on line 22 1