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 239 views
2 answers 245 views
1 answer 210 views
2 answers 252 views
252 views asked Jul 22, 2016 by avibootz
2 answers 266 views
...