I have the following code:
$pal = "3,5 1401 4145 7854 8454 7458 5152556555 3,5 1401 4145 7854 8454 7458 5152556555 3,5 1401 4145 7854 8454 7458 5152556555";
$pal = explode(" ",$pal);
print_r($pal);
The result is something like this:
Array
(
[0] => 3,5
[1] => 1401
[2] => 4145
[3] => 7854
[4] => 8454
[5] => 7458
[6] => 5152556555
[7] => 3,5
[8] => 1401
[9] => 4145
[10] => 7854
[11] => 8454
[12] => 7458
[13] => 5152556555
[14] => 3,5
[15] => 1401
[16] => 4145
[17] => 7854
[18] => 8454
[19] => 7458
[20] => 5152556555
)
The data of the $ pal variable is entered from a textbox, its content is something like:
valor Codigo serial
3,5 1401 4145 7854 8454 7458 5152556555
3,5 1401 4145 7854 8454 7458 5152556555
3,5 1401 4145 7854 8454 7458 5152556555
I would like the data to be stored in a database after doing the explode with the following logic:
// He visto por alli algo como esto:
list($valor,$codigo,$serial) = explode(" ",$pal);
$codigo = $pal[1] .$pal[2] .$pal[3] .$pal[4] .$pal[5];
echo $valor; // Imprime su valor
echo $codigo; // Imprime el codigo
echo $serial; // Imprime el serial
But I do not know how to get the text block separated in the way I am requiring it.