Reputation: 285
Lately what I've wanted to do is read specific text after a specific character. What I want to do is read the numbers after an equal sign. This is the text that I have:
Lime Green = 13,
Sensei Gray = 14,
Aqua = 15,
Arctic White = 16,
Black Sunglasses = 101,
Dark Vision Goggles = 102,
The numbers that are after the "=" sign is the ID for the text. What I want to do is grab the ID for the text an place it in the variable $id, any help would be highly appreciated!
Upvotes: 0
Views: 732
Reputation: 1048
Use regular expression for this
$content="Lime Green = 13,
Sensei Gray = 14,
Aqua = 15,
Arctic White = 16,
Black Sunglasses = 101,
Dark Vision Goggles = 102,";
preg_match_all("/=(.*),/siU",$content,$output);
print_r($output[1]);
Upvotes: 1
Reputation: 8818
Upvotes: 0