3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = ["a","b","c"]; var_dump(json_encode($arr1)); $arr2 = [1=>"A", 4=>"b", 10=>"c"]; var_dump(json_encode($arr2)); $arr3 = [1=>"A", 14=>"b", 10=>"c"]; var_dump(json_encode($arr2));
Output for 7.3.0 - 7.3.29, 7.4.0 - 7.4.21, 8.0.0 - 8.0.8
string(13) "["a","b","c"]" string(26) "{"1":"A","4":"b","10":"c"}" string(26) "{"1":"A","4":"b","10":"c"}"

preferences:
140.53 ms | 532 KiB | 16 Q