0
I have the string down and I’ve tried to turn it into a Multidimensional array but I don’t know how to do it, another problem I can’t solve is the spaces, even using a explode they remain in the array. any help is welcome.
The multidimensional array I want is this:
Array(2) ( [0] => Array ( [0] => 12/ 8/2008 [1] => 0 [2] => maria [3] => online) [1] => Array ([0] => 13/ 5/2013 [1] => 0 [2] => joão [3] => off));
My code.
$string = "0/ 0/0 0 maria online 0/ 0/0 0 joão off";
$ar = explode(" ", $string);
print_r($ar);
If you know the function explodes, and you probably know the repetition structures, I think you have to work on the programming logic now!
– Vinicius De Jesus
A question the date you add as? Or the date already comes in the string? The command
trim($variavel)
removes the spaces at the beginning and end of the variable. Because if you have these separate data and group, you are like$string = "0/0/00 maria online 0/0/00 joão off";
it is better to separate afterwards.– Luiz Fernando