Created
March 5, 2011 18:33
-
-
Save avinash2/856584 to your computer and use it in GitHub Desktop.
Outputting all the values stored in a multidimensional array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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