Accessing results of JSON with PHP problem


I have a problem with accessing results from JSON with PHP.

Different levels of data require a different number:

echo [$data][0][colour]
echo [$data][1][colour]
echo [$data][2][colour]

How can I get the number to increment upwards and stop at the final result?

For example if there was only 1 result [1] and [2] would not be asked for, etc.


your example is invalid. use foreach to loop through arrays, it will stop after the last entry.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.