3v4l.org

run code in 300+ PHP versions simultaneously
<?php function key_compare_func($key1, $key2) { var_dump($key1, $key2, $key1 == $key2, $key1 > $key2); if ($key1 == $key2) return 0; else if ($key1 > $key2) return 1; else return -1; } $a=new stdClass; $a->{"0"}=1; $a->n=2; echo "key\n"; var_dump(array_diff_key((array)$a, [0])); echo "ukey\n"; var_dump(array_diff_ukey((array)$a, [0], 'key_compare_func'));

preferences:
49.4 ms | 402 KiB | 5 Q