3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(array_filter([1,2,3], function(&$v) {$v = 17;return true;}));
Output for 8.4.1
Warning: {closure:/in/T0fvi:3}(): Argument #1 ($v) must be passed by reference, value given in /in/T0fvi on line 3 Warning: {closure:/in/T0fvi:3}(): Argument #1 ($v) must be passed by reference, value given in /in/T0fvi on line 3 Warning: {closure:/in/T0fvi:3}(): Argument #1 ($v) must be passed by reference, value given in /in/T0fvi on line 3 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14
Warning: {closure}(): Argument #1 ($v) must be passed by reference, value given in /in/T0fvi on line 3 Warning: {closure}(): Argument #1 ($v) must be passed by reference, value given in /in/T0fvi on line 3 Warning: {closure}(): Argument #1 ($v) must be passed by reference, value given in /in/T0fvi on line 3 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
Output for 5.6.0 - 5.6.29
array(3) { [0]=> int(17) [1]=> int(17) [2]=> int(17) }

preferences:
82.66 ms | 410 KiB | 5 Q