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 Quote Link to comment Share on other sites More sharing options...
Solution DulongC Posted May 20, 2017 Solution 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. } 1 Quote Link to comment Share on other sites More sharing options...
MoFish Posted May 20, 2017 Author Share Posted May 20, 2017 Perfect, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.