3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Oele\nBoele\n\nDus Want\n\nBlaaaaaaaaaaaa"; $text = '<p>' . $text . '</p>'; $text = preg_replace('#\n\n#', '</p><p>', $text); $text = preg_replace('#\n#', '<br />', $text); $text = preg_replace('#><#', ">\n<", $text); echo $text;

preferences:
44.32 ms | 402 KiB | 5 Q