3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['name' => 'foo'], ['bar' => 'foo'], ]; usort($array, function ($a, $b) { return strcmp($a['name'], $b['nope']); }); echo 'after calling usort:'.PHP_EOL.PHP_EOL; var_dump($array);
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: Undefined array key "nope" in /in/SuJRd on line 9 Deprecated: strcmp(): Passing null to parameter #2 ($string2) of type string is deprecated in /in/SuJRd on line 9 after calling usort: array(2) { [0]=> array(1) { ["bar"]=> string(3) "foo" } [1]=> array(1) { ["name"]=> string(3) "foo" } }

preferences:
52.14 ms | 407 KiB | 5 Q