How to know the name of the array with foreach?

Iterate this array
5e9b691861715737829960.png

How can I in the foreach to know the names of these iterate through arrays? blink and TP
April 19th 20 at 12:46
1 answer
April 19th 20 at 12:48
Solution
foreach ($data as $name => $values) {
 echo 'array Name: ', $name, PHP_EOL;
}
Thank you!
php_eol better br and \n, or the difference is no? - Theresa.Kilback commented on April 19th 20 at 12:51
@Theresa.Kilback, PHP_EOL contains the correct newline character for the system in the environment which PHP runs. If you need to write something to the console and do a newline, it is better to use PHP_EOL, but if you need to output something to the page, then it is better <br/> - Monica85 commented on April 19th 20 at 12:54
@Theresa.Kilback, PHP_EOL is a constant, not to write "\n" string. < br > is html tag is not interchangeable concepts. - daphney.Kutch commented on April 19th 20 at 12:57
@Monica85, @daphney.Kutch, got it, thanks! - Theresa.Kilback commented on April 19th 20 at 13:00

Find more questions by tags PHP