Problem with object

From: Date: Fri, 10 May 2002 08:34:30 +0000
Subject: Problem with object
Groups: php.general 
Request: Send a blank email to php-general+get-96920@lists.php.net to get a copy of this message
Hello! I have an object: class Entry { var $ip; var $host; } Which is stored in an array: $aLines = array(); ... array_push($aLines, new Entry($ip)); // Do this several times Now I want to resolve the hostname from ip adresses: foreach ($aLines as $entry) { if ($entry->host == "") $entry->host = "Teststring"; print $entry->host."\n"; // prints "Teststring" } // Testoutput foreach ($aLines as $entry) { print $entry->host."\n"; // prints empty string! } Why is host in the second loop empty again? Martin

« previous php.general (#96920) next »