Skip to content
Advertisement

Return PHP array name

JavaScript

I’ve got those two arrays inside one array. The top array holds them both, then below is each one individually. When I am displaying the individual arrays, how do I echo their name?

So the first would be kanye, then list the contents, etc.

Hope that makes sense. I know it will be a simple bit of code but it’s stumping me.

Advertisement

Answer

You can use a foreach statement to get the key value pair of the array:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement