Hi Joseph, it is the problem of using list(..) = each Each - Return the current key and value pair from an array and advance the array cursor
So your list($lat,$lng) = each($coords) will assign $lat = 0 and $lng = ($lat you passed), creating the weird output. Changing the function to as shown below should clear your woes. function nextCoord($coords, $usedCoords) { $lat = (float)$coords[0]; $lng = (float)$coords[1]; if(in_array($lat.':'.$lng, $usedCoords)) { $lat += 0.0005; $lng += 0.0005; return nextCoord(array($lat, $lng), $usedCoords ); } $array = array($lat, $lng); print_r($array); // disable this after debug // return $array; // enable this after debug } -- Jiju Thomas Mathew http://www.php-trivandrum.org
_______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php