3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(&$str) { $str = 'xyz'; return $str; } $o = "abc"; foo($o); var_dump($o); $o = "abc"; call_user_func('foo', $o); var_dump($o); $o = "abc"; call_user_func('foo', [$o]); var_dump($o); $a[] = "abc"; $a[] = "abc"; $a[] = "abc"; call_user_func('foo', array_slice($a, 0, 1)); var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
string(3) "xyz" Warning: foo(): Argument #1 ($str) must be passed by reference, value given in /in/OEOA1 on line 12 string(3) "abc" Warning: foo(): Argument #1 ($str) must be passed by reference, value given in /in/OEOA1 on line 15 string(3) "abc" Warning: foo(): Argument #1 ($str) must be passed by reference, value given in /in/OEOA1 on line 21 array(3) { [0]=> string(3) "abc" [1]=> string(3) "abc" [2]=> string(3) "abc" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
64.9 ms | 402 KiB | 8 Q