While using PHP it's hard to keep guessing the contents of any $value that you're playing about with.
Recently @nielslange showed me how to make this much easer with a simple debug function:
By placing this short snippet (I'd recommend in your functions.php file, then you can later use this debug again) you can then use:
on any $value in your PHP to see the contents!
Here's an example:
Now reloading that PHP file shows the associated values to $images neatly within <pre> tags.
In my case, this showed the contents of $images as:
With the above information we can quickly write out our PHP without relying on guessing. Effective, thanks Niels!