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; echo $f->bar() . "\n"; $f->bar('bar'); echo $f->bar() . "\n"; echo (int)$f;
based on jVCFF
Output for 5.1.0 - 7.1.0
foo bar Notice: Object of class Foo could not be converted to int in /in/Dn7P7 on line 22 1
Output for 5.0.0 - 5.0.5
foo bar Object id #1
Output for 4.3.0 - 4.4.9
foo bar 0