3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dis = [45 => 422.555, 67=> 596.555, 72 => 322.55]; asort($dis); $arrs = reset($dis); echo key($arrs);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: key(): Argument #1 ($array) must be of type array, float given in /in/JHGin:6 Stack trace: #0 /in/JHGin(6): key(322.55) #1 {main} thrown in /in/JHGin on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: key() expects parameter 1 to be array, float given in /in/JHGin on line 6

preferences:
146.07 ms | 402 KiB | 174 Q