3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function test($a, $b) { var_dump('A:' . $a); var_dump('B:' . $b); } } $a = new A; call_user_func_array([$a, 'test'], ['1', '2']); // this works call_user_func_array([$a, 'test'], ['b' => '2', 'a' => 1]); // this works too call_user_func_array([$a, 'test'], ['c' => 1, 'd' => 2]); // this deoesnt work since php8 since there are no parametes names c or d
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
string(3) "A:1" string(3) "B:2" string(3) "A:1" string(3) "B:2" Fatal error: Uncaught Error: Unknown named parameter $c in /in/DAsGO:14 Stack trace: #0 {main} thrown in /in/DAsGO on line 14
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 7.4.0 - 7.4.33
string(3) "A:1" string(3) "B:2" string(3) "A:2" string(3) "B:1" string(3) "A:1" string(3) "B:2"

preferences:
141.69 ms | 408 KiB | 5 Q