How to encode JSON from array with ordered indexes in PHP

1 Answer

0 votes
$json = json_encode([0 => 'php', 2 => 'java', 3 => 'python']);
var_dump($json);
 

/*
run:

string(35) "{"0":"php","2":"java","3":"python"}"

*/

 



answered Jul 24, 2018 by avibootz

Related questions

1 answer 235 views
2 answers 236 views
1 answer 201 views
2 answers 242 views
242 views asked Jul 22, 2016 by avibootz
2 answers 255 views
...