real_illusions Posted March 1, 2011 Share Posted March 1, 2011 Hi all,I've got some code that, in theory, should work. $altimages = get_image_alt($file);echo "<ul>";foreach ($altimages as $key => $value) { echo "<li>". $key . "; " . $value ."</li>"; }echo "</ul>"; I've left off the function (get_image_alt), as I know that works. Echoing out the Array (with print_r) displays an associative array. Now, when I run the above code, I get this: * 0; Array * 1; 98Why is it doing that and not displaying the content of the array? Link to comment Share on other sites More sharing options...
birbal Posted March 1, 2011 Share Posted March 1, 2011 echo wont display the array members. probably your $altimages[0] holding another array. var_dump it. it will show you what it is holding to be sure. Link to comment Share on other sites More sharing options...
thescientist Posted March 1, 2011 Share Posted March 1, 2011 what's the output of print_r($altimages)?edit: or var_dump it as birbal suggested. you probably have to dig deeper into the array as birbal also said. Link to comment Share on other sites More sharing options...
real_illusions Posted March 1, 2011 Author Share Posted March 1, 2011 Seems there's an Array within an Array. Have figured it out with a simple change to this line:foreach ($altimages[0] as $key => $value) { Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.