Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multideminsional arrays with foreach()

Status
Not open for further replies.

jimbojames5645

Programmer
Joined
Dec 12, 2003
Messages
36
Location
US
I am trying to create a script that checks for correct PTR records using linux host command. I am checking against three dns servers so I have an array like such :
$servers =array(array "name" => "somename", "ip" => "10.0.0.0", "result" => 0),
array "name" => "somename", "ip" => "10.0.0.0", "result" => 0));

I am doing a foreach ($servers as $v) and modifying $v["result"], however when I leave the foreach() $servers[0]["result"] doesn't retain any of the changes made by the foreach(). I have checked to see that changes are applied with a print_r($v) inside the foreach(), and there are changes that do not stay after the foreach() is finished.

Any ideas as to why the changes don't last?
 
$servers =array(array "name" => "somename", "ip" => "10.0.0.0", "result" => 0),
array("name" => "somename", "ip" => "10.0.0.0", "result" => 0));

typo there ^

Also note, there are no errors coming up.
 
Posting your
Code:
foreach
loop would help.

//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top