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 245 views
2 answers 252 views
1 answer 213 views
2 answers 261 views
261 views asked Jul 22, 2016 by avibootz
2 answers 274 views
...