3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [1 => 'a', 2=> 'b', 3 => 'c']; $b = [1, 3]; var_dump(array_intersect_ukey($a, $b, function ($item, $c, $d) { var_dump($item); var_dump($c); return $item === $c; }));
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 2 passed and exactly 3 expected in /in/u0otu:5 Stack trace: #0 [internal function]: {closure}(1, 2) #1 /in/u0otu(5): array_intersect_ukey(Array, Array, Object(Closure)) #2 {main} thrown in /in/u0otu on line 5
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 2 passed and exactly 3 expected in /in/u0otu:5 Stack trace: #0 [internal function]: {closure}(1, 2) #1 /in/u0otu(5): array_intersect_ukey(Array, Array, Object(Closure)) #2 {main} thrown in /in/u0otu on line 5
Process exited with code 255.
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 2 passed and exactly 3 expected in /in/u0otu:5 Stack trace: #0 [internal function]: {closure}(1, 2) #1 /in/u0otu(9): array_intersect_ukey(Array, Array, Object(Closure)) #2 {main} thrown in /in/u0otu on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.31
Warning: Missing argument 3 for {closure}() in /in/u0otu on line 5 int(1) int(2) Warning: Missing argument 3 for {closure}() in /in/u0otu on line 5 int(2) int(3) Warning: Missing argument 3 for {closure}() in /in/u0otu on line 5 int(0) int(1) Warning: Missing argument 3 for {closure}() in /in/u0otu on line 5 int(1) int(0) Warning: Missing argument 3 for {closure}() in /in/u0otu on line 5 int(2) int(1) array(2) { [1]=> string(1) "a" [2]=> string(1) "b" }

preferences:
136.88 ms | 402 KiB | 211 Q