3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { function bar($new = null) { static $bar = 'foo'; if ($new !== null) { $bar = $new; } return $bar; } } $f = new Foo; $g = new Foo; echo $f->bar() . "\n"; $f->bar('bar'); echo $f->bar() . "\n"; echo (int)$f; echo (int)$g;
based on Dn7P7
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
foo bar Notice: Object of class Foo could not be converted to int in /in/ugoJK on line 23 1 Notice: Object of class Foo could not be converted to int in /in/ugoJK on line 24 1
Output for 5.0.0 - 5.0.5
foo bar Object id #1Object id #2
Output for 4.3.0 - 4.4.9
foo bar 00