Mihail Mojsoski Mihail Mojsoski - 1 year ago 78
PHP Question

PHP While Loop for Multidimensional Arrays

So i tried to loop through bunch of arrays using the while loop.
So it does not work like this, how does it work?

$o = $o . "<Server>

The error is in this line(s):


is not allowed and i do not know how i can loop through them, any ideas?

Answer Source

I would rewrite it this way:

$s = $sQuery($SERVER);

for($i=0; $i<$s['number']; $i++)
    $o .= "<Server><Name>".$s[$i]['name']."</Name>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download