3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $subject = <<<HTML <div class="tabs_container"> <ul class="tabs"> ##BEGINLOOP##gAs## <li><a href="#">##title##</a></li> ##ENDLOOP## </ul> ##BEGINLOOP##LI## <div class="tabs_content">##title## is ##content##</div> ##ENDLOOP## </div> HTML; $parts = preg_split('/(?:##BEGINLOOP##)([a-zA-Z]*)##(.+?)(?:##ENDLOOP##)/s', $subject, -1, PREG_SPLIT_DELIM_CAPTURE); var_dump($parts);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(7) { [0]=> string(51) "<div class="tabs_container"> <ul class="tabs"> " [1]=> string(3) "gAs" [2]=> string(48) " <li><a href="#">##title##</a></li> " [3]=> string(11) " </ul> " [4]=> string(2) "LI" [5]=> string(66) " <div class="tabs_content">##title## is ##content##</div> " [6]=> string(7) " </div>" }