3v4l.org

run code in 300+ PHP versions simultaneously
<?php function title() { $title_segments =& func_get_args(); //change argument 1 ($a) to C $title_segments[0] = 'C'; var_dump($title_segments); } $a = 'A'; title($a); //passing by reference in PHP < 7.2 does not result in intended results of $a as 'C' var_dump($a);
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
Fatal error: Cannot use result of built-in function in write context in /in/oEH3G on line 5
Process exited with code 255.
Output for 4.4.0 - 4.4.9, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Only variables should be assigned by reference in /in/oEH3G on line 5 array(1) { [0]=> string(1) "C" } string(1) "A"
Output for 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Strict Standards: Only variables should be assigned by reference in /in/oEH3G on line 5 array(1) { [0]=> string(1) "C" } string(1) "A"
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4
array(1) { [0]=> string(1) "C" } string(1) "A"

preferences:
277.29 ms | 1399 KiB | 369 Q