3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { var $p; function m($v) { echo $this->p, $v, "\n"; } } function f($c) { for($i=0; $i<10; ++$i) $c($i); } $c = new C(); $c->p = 'X'; f(array(&$c, 'm'));
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
X0 X1 X2 X3 X4 X5 X6 X7 X8 X9
Output for 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Fatal error: Function name must be a string in /in/KfEWD on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/KfEWD on line 5 Fatal error: Function name must be a string in /in/KfEWD on line 17
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Array to string conversion in /in/KfEWD on line 17 Fatal error: Call to undefined function: array() in /in/KfEWD on line 17
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Notice: Array to string conversion in /in/KfEWD on line 17 Fatal error: Call to undefined function: array() in /in/KfEWD on line 17
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Array to string conversion in /in/KfEWD on line 17 Fatal error: Call to undefined function: array() in /in/KfEWD on line 17

preferences:
220.46 ms | 401 KiB | 306 Q