3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = [0]; $out = array_filter($in, function(&$v) { $v = 1; return 1; }); var_dump($in, $out);
Output for 8.4.1 - 8.4.2
Warning: {closure:/in/8dlfb:4}(): Argument #1 ($v) must be passed by reference, value given in /in/8dlfb on line 4 array(1) { [0]=> int(0) } array(1) { [0]=> int(0) }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15
Warning: {closure}(): Argument #1 ($v) must be passed by reference, value given in /in/8dlfb on line 4 array(1) { [0]=> int(0) } array(1) { [0]=> int(0) }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
array(1) { [0]=> int(0) } array(1) { [0]=> int(0) }
Output for 5.6.0 - 5.6.25
array(1) { [0]=> int(1) } array(1) { [0]=> int(1) }

preferences:
104.38 ms | 409 KiB | 5 Q