I have a long string like: B1C1F4G6H4I7J1J8L5O6P2Q1R6T5U8V1Z5, and i need to explode it on pairs so in this case 1 - B1 2 - C1 and so on...
The reason why i need that is that each pair contains 1 information in database so i have to take each of that pair and make some cycle or something to MySQL search
I was thinking about convert that sting to array like this:
1=> B1
2=> C1
3=> F4
and then foreach that with something like
foreach ($array as $arr)
{
//and here come database search
}
But maybe i am completly wrong and to say true everything i try finish with ERROR so guys i am up for any advise, if somebody have time to write an example code it will be awesome.
Thanks!
p.s. First of all i was thinking about something like:
$string[0] = substr($string,0,2);
$string[1] = substr($string,2,4);
but string will changing and I never know how long it will be
substr+for+strlen$array = str_split($string, 2);strlen. Then just iterate from0up tostrlenwith+ 2step.