MoFish Posted May 20, 2017 Share Posted May 20, 2017 Hi All, I have mark-up which contains many {{edit:xxx}} tags this is inside a variable called $html I'm trying to find all these edit tags and displaying the name, but am not sure best how to achive it. For example my $html contains: {{edit:top}} {{edit:bottom}} {{edit:left}} {{edit:right}} I want to create a $results array with the following values: top bottom left right Many thanks, MoFish Link to comment Share on other sites More sharing options...
DulongC Posted May 20, 2017 Share Posted May 20, 2017 You can achieve this with preg_match_all $success = preg_match_all("/{{edit:(.*?)}}/i", $html, $results); if ($success) { $results = $results[1]; //$results now contains all your edit values, you can do what you want with them. } Link to comment Share on other sites More sharing options...
MoFish Posted May 20, 2017 Author Share Posted May 20, 2017 Perfect, thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.