- json_decode: documentation ( source)
- print_r: documentation ( source)
- asort: documentation ( source)
- json_encode: documentation ( source)
<?php
$testarr = [
'0' => 'England',
'1' => 'Wales',
'2' => 'Scotland',
'3' => 'Ireland'
];
asort($testarr);
print_r($testarr);
$jsontestarr = json_encode($testarr);
$decoded = json_decode($jsontestarr);
print_r($decoded);