I got this string that I'm getting from a table in mysql
$my_string = 40-10-10,41-20-20,42-30-30;
And i'm using this to explode it
$my_array = explode(',', $my_string); and with print_r I get this:
Array
(
[0] => 40-10-10
[1] => 41-20-20
[2] => 42-30-30
)
Now I would like to get every element of that array into another arrays, for example:
[0] => 40-10-10 should be an array like this
Array
(
[0] => 40
[1] => 10
[2] => 10
)
And then those values into variables
$v1 = 40;
$v2 = 10;
$v3 = 10;
And do the same to rest of elements an arrays, I'm stuck and I do not have idea how to achieve this, I need some help, thanks.
explode()again but just leave them in the array and don't worry about individual vars.