3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { public function run() { array_walk($list = ['fuck', 'white'], [$this, 'sqlFilter']); var_dump($list); } private function sqlFilter($key, &$value) { $value = ucfirst($value); } } (new test)->run();
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught Error: array_walk(): Argument #1 ($array) could not be passed by reference in /in/t6v7Y:5 Stack trace: #0 /in/t6v7Y(12): test->run() #1 {main} thrown in /in/t6v7Y on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Fatal error: Uncaught Error: array_walk(): Argument #1 ($array) cannot be passed by reference in /in/t6v7Y:5 Stack trace: #0 /in/t6v7Y(12): test->run() #1 {main} thrown in /in/t6v7Y on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Only variables should be passed by reference in /in/t6v7Y on line 5 array(2) { [0]=> string(4) "fuck" [1]=> string(5) "white" }
Output for 7.3.32 - 7.3.33
array(2) { [0]=> string(4) "fuck" [1]=> string(5) "white" }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/t6v7Y on line 5 array(2) { [0]=> string(4) "fuck" [1]=> string(5) "white" }

preferences:
174.8 ms | 402 KiB | 213 Q