I'm loading a json file where there's an object data
, which has properties that are only integers.
They begin with 1000
then increment until 9999
. Everything is ok. The problem comes with the properties 10000
and higher. When I load the file using json_decode(file_get_contents('myjsonfile'))
, if I try to do a foreach
loop I have all the properties that begin with 1000
first, so this includes all the properties 10000
then I have other ones (2000
, 3000
, and so on).
The actual problem is that I need to keep the keys (because the properties are objects that sometimes contain link to keys of the "base" data
object).
How can you make a working foreach
loop with keys ordered asc?