I have simple text string, it is looking like that:
30143*1,30144*2,30145*3,30146*5,30147*5
And i have to transform this text string to array with this structure:
Array ( [0] => Array ( [product] => 30143 [qty] => 1 ) [1] => Array ( [product] => 30144 [qty] => 2 ) [2] => Array ( [product] => 30145 [qty] => 3 ) [3] => Array ( [product] => 30146 [qty] => 4 ) [4] => Array ( [product] => 30147 [qty] => 5 ) )
Is it even possible and if so how?
I found this:
$myString = "9,admin@example.com,8";
$myArray = explode(',', $myString);
print_r($myArray);
But this is only creating the array with no keys and wtih example there is no way to get the qty
key with *
.
Thanks in advance!