1
My question is a bit complex, for which I will try to explain.
I have a php variable, which always shows results as follows:
"8017990310062\r8017990142064\r801792340068\r"
What I intend to do is "tidy" the displayed numbers of the variable and assign in an array, that is, first I intend to take the quotes of the variable, then remove the r and then take the numbers and each array has a number.
Example:
$array[0] = 8017990310062;
$array[1] = 8017990142064;
$array[2] = 801792340068;
Note that my variable may have more than 3 values, for example 5
, 7
or 8
.
How can I do this?
Try it out there:
explode('\r', $var);
If I understand correctly, I think you’ll get what you want. A$var
is your whole string– Miguel
I think that’s right, however how do I first remove the "quotes" of the variable result?
– Gonçalo
You have an answer already down that does what you want Gonçalo
– Miguel