I am new to php and I have no idea how to extract the exact things I want in a string.
for example:
Instant Oats Drink - Chocolate Flavour 165g (33g x 5)
I want to extract this data so that
Name: Instant Oats Drink - Chocolate Flavour
Weight: 165g
number of pack: 5
unit weight: 33g
Please give me some help on this question.
If all of your strings have that same form you can use regular expressions.
consider that :
Based on @Troy answer you can even use that one that is even sorten