Array with string of data

Hello,

I have a string of numbers (lat & long) that i’ve been able to split into each line. What I need to do is make every other number (the longitude) a second variable of an array.

i.e…with a while loop until the number of words have been reached-

3929 needs to be $var_one[$i]
7658 needs to be $var_two[$i]
3922 needs to be $var_one[$i]
7649 needs to be $var_two[$i]

Understand?

I’m sure theres some sort of string function that can be used to do this in a while loop for the count of words.
Then, after I do that (maybe during the while loop?) convert the first number to a decimal (easy) and make the longitude(the 2nd variable) a negative number with a decimal.

Thanks again!

What is a separator in your string of values? Are pairs of lan & long groupped?
Check the explode() function, it returns an array. If you need to perform more complicated splitting, use this function: preg_split().

Sponsor our Newsletter | Privacy Policy | Terms of Service