Reverse key value array in JSON (PHP) -


i have key value array in php this

[1]=>"something" [2]=>"somethingelse" [4]=>"this" 

now export json, reverse array, keep indexes. json format like

{     "4":"this",     "2":"somethingelse"     "1":"something" } 

is there easy way accomplish (without parsing json manually)?

$reverse = array_reverse($array, true); $json = json_encode ($reverse); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -