3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = '<green>hello <red>aydin</red> wth</green>'; $matches = array(); preg_match('/(<.+?>)(.+?)(<\/.*>)/', $string, $matches); $fullString = $matches[0]; //$stripped = var_dump($matches);
Output for 4.3.0 - 7.1.0
array(4) { [0]=> string(41) "<green>hello <red>aydin</red> wth</green>" [1]=> string(7) "<green>" [2]=> string(16) "hello <red>aydin" [3]=> string(18) "</red> wth</green>" }