Cyprich.com

Occasionally Relevant Insights from a Software Builder

By

How To Iterate Through an Associated Array in PHP

The following code will allow you to iterate through any associated array in PHP. The keys in the array are displayed in a bold font.


foreach ($list as $i => $values)
{
foreach ($values as $key => $value)
echo "$key => $value";

echo "
";
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.