The-Last-Escape Posted May 3, 2007 Share Posted May 3, 2007 if I have an array $result how do I echo all the contents? $result[1], $result[2]..etc Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/ Share on other sites More sharing options...
ToonMariner Posted May 3, 2007 Share Posted May 3, 2007 print_r($result); Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244206 Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Thanks Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244208 Share on other sites More sharing options...
DaveEverFade Posted May 3, 2007 Share Posted May 3, 2007 if you have a lot of results or arrays in arrays I find it a lot easier to read when you do this: echo "<pre>"; print_r($result); echo "</pre>"; Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244211 Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Cheers Dave for that Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244215 Share on other sites More sharing options...
Barand Posted May 3, 2007 Share Posted May 3, 2007 with PHP 4.3.0 or later, you can echo '<pre>', print_r($array, true), '</pre>'; Same as above but a one-liner Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244217 Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Thanks for again for your advice Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244225 Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 foreach($result as $key => $value){ echo " Key - ".$key." value - ".$value; echo "<br>"; } Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244231 Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Yes thanks its solved now Link to comment https://forums.phpfreaks.com/topic/49785-solved-array/#findComment-244233 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.