3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<HTML <p>my text 1</p> some other content <p>some other paragraph followed by an html line break</p><br> etc... HTML; $string = preg_replace('~</?[a-z]+>\R(*SKIP)(*FAIL)|$~m', '<br>', $string); var_export($string); echo "\n----\n"; var_export(json_encode($string));

preferences:
30.4 ms | 406 KiB | 5 Q