PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mhouldridge
Forum Contributor
Posts: 267 Joined: Wed Jan 26, 2005 5:13 am
Post
by mhouldridge » Fri Jul 01, 2005 9:24 am
Hi,
I have array data which I need to format. Currently the output looks like this;
[0] => 192.168.241.1
[1] => 192.168.241.2
[2] => 192.168.241.3
[3] => 192.168.241.5
[4] => 192.168.241.7
and my script to output this is as follows;
Code: Select all
echo'<pre>';
print_r($available_ips);
echo '</pre>'
Is there anyway to html format this or to simply take out the "[0] =>" part so that the IPs are the only thing shown?
thanks in advance
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Jul 01, 2005 9:42 am
print_r() is intended more as a debug function, not for presentation.
To get the actual details you need use a foreach loop. For example....
Code: Select all
foreach($available_ips as $value) {
echo $value.'<br />';
}