3v4l.org

run code in 300+ PHP versions simultaneously
<?php $X = '{"a":"a","b":"b","c":"c","d":"d","e":"e","f":"f9","g":"g2","h":"h1"}'; print_r((fn()=>array_keys(json_decode($X,1)))()); print_r((fn()=>array_values(json_decode($X,1)))());
Output for 7.4.4 - 7.4.29, 8.0.0 - 8.0.19, 8.1.0 - 8.1.6
Array ( [0] => a [1] => b [2] => c [3] => d [4] => e [5] => f [6] => g [7] => h ) Array ( [0] => a [1] => b [2] => c [3] => d [4] => e [5] => f9 [6] => g2 [7] => h1 )
Output for 7.1.25 - 7.1.32, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/b7nDL on line 5
Process exited with code 255.

preferences:
57.48 ms | 410 KiB | 5 Q