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 Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted May 3, 2007 Share Posted May 3, 2007 print_r($result); Quote Link to comment Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Thanks Quote Link to comment 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>"; Quote Link to comment Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Cheers Dave for that Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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>"; } Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.