I have check the obvious.
For example the 'Illouz|35.7,-0.6166667,0,1, |1|1|134' string below seperates into '35.7,-0.6166667' and ',0,1, ' but the others are fine. 'Illouz' is actually the 84th '::' part of the string.
Code: Select all
$thestring = "Illouz|35.7,-0.6166667,0,1, |1|1|134::Isly|36.7833333,3.05,0,1, |1|1|134::Faubourg D'el Kantara|36.3694444,6.6211111,0,1, |1|1|134::";
$array = explode("::",$thestring);
$num2 = count($array); // Entry count
$array2 = array();
for ($i = 0 ; $i < $num2 ; $i++) {
$array2 = explode("|",$array[$i]); // Explode the array to get the variables
$num = count($array2);
for ($n = 0 ; $n < $num ; $n++) {
$array3["arg".$n] = $array2[$n];
}
$location_name = str_replace("`","'",$array3['arg0']);
$geo_data = trim($array3['arg1']);
$location_type = trim($array3['arg2']);
//$unused = trim($array3['arg3']); //Unused
$country_id = trim($array3['arg4']);
//Check the values
echo "$country_id : $location_name : $geo_data : $location_type<br />";
}