3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = ["a","b","c"]; var_dump(json_encode($arr1)); $arr2 = [1=>"A", 3=>"b", 4=>"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(25) "{"1":"A","3":"b","4":"c"}" string(25) "{"1":"A","3":"b","4":"c"}"

preferences:
106.58 ms | 459 KiB | 5 Q