Jump to content

SOLVED: foreach loops


skaterdav85

Recommended Posts

EDIT: Turns out it was some CodeIgniter specific stuff that I didn't fully understand.So I am having a problem with my foreach loop. $showStringArr is a property that holds an array of addresses.

foreach($this->showStringArr as $showLocation){				//now geocode each showLocation			$address = urlencode($showLocation);			$url = array("url"=>"http://tinygeocoder.com/create-api.php?q=$address");			$this->load->library('RemoteConnector', $url); //CodeIgniter syntax to load a class			$coord = $this->remoteconnector->__toString(); //CodeIgniter syntax to get the string contents of the remote file			echo $showLocation." | ".$coord."\n";}

My problem is that what comes out of that echo statement is each unique address, but the coordinates returned from the web service are all the same. The coordinates ouputed in $coord are all for the first address. Does this have something to do with the web service call taking longer than the foreach loop?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...