Skip to content

Instantly share code, notes, and snippets.

@avinash2
Created March 5, 2011 18:33
Show Gist options
  • Save avinash2/856584 to your computer and use it in GitHub Desktop.
Save avinash2/856584 to your computer and use it in GitHub Desktop.
Outputting all the values stored in a multidimensional array
<?php
$file = "img/15.jpeg";
$data = exif_read_data($file);
echo "<ul>\n";
foreach ($data as $key => $value)
{
// Checks if $value is an array
if (is_array($value)) {
echo "<li><strong>{$key}</strong>:</li>\n";
// ... and prints out a new list containing values stored in the
// nested array.
echo "\t<ul>\n";
foreach ($value as $property => $result) {
echo "\t\t<li>{$property} : {$result}</li>\n";
}
echo "\t</ul>\n";
} else { // Continues the previous list if $value is not an array
echo "<li>{$key} : {$value}</li>\n";
}
}
echo "</ul>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment