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) { 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
int(1) int(2) Deprecated: array_intersect_ukey(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/RCZFC on line 5 int(2) int(1) int(2) int(3) int(3) int(2) int(0) int(1) int(1) int(0) int(1) int(0) int(0) int(1) int(2) int(1) int(1) int(2) array(2) { [1]=> string(1) "a" [2]=> string(1) "b" }
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 int(1) int(2) Deprecated: array_intersect_ukey(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/RCZFC on line 5 int(2) int(1) int(2) int(3) int(3) int(2) int(0) int(1) int(1) int(0) int(1) int(0) int(0) int(1) int(2) int(1) int(1) int(2) array(2) { [1]=> string(1) "a" [2]=> string(1) "b" }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
int(1) int(2) Deprecated: array_intersect_ukey(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/RCZFC on line 9 int(2) int(1) int(2) int(3) int(3) int(2) int(0) int(1) int(1) int(0) int(1) int(0) int(0) int(1) int(2) int(1) int(1) int(2) array(2) { [1]=> string(1) "a" [2]=> string(1) "b" }
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.21, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
int(1) int(2) int(2) int(3) int(0) int(1) int(1) int(0) int(2) int(1) array(2) { [1]=> string(1) "a" [2]=> string(1) "b" }

preferences:
156.67 ms | 403 KiB | 204 Q