3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>"; // $html = "<p>some thing</p>shitty p stuff<p>correct</p>\r\n<p>what about this</p>this is not correct\n"; // $html = "<p>some thing</p><p>shitty p stuff</p><p>correct</p><p>what about this</p>this is not correct"; // $html = "<p><a href=\"http://www.beataheuman.com/shop/\" title=\"www.beataheuman.com\">www.beataheuman.com</a>.</p><br />"; // $html = "ptest"; var_dump($html); // add <p></p> to the text if missing var_dump($html); // fix not closed paragraphs // $html = preg_replace('~(<p>.*?)([^</p>]<p>)~', '$1</p><p>', $html); var_dump($html); $html = preg_replace('~(\r\n|\n|\r)~s', '', $html); var_dump($html); // add into p the text in between paragraphs $html = preg_replace('~</p>([^<p>].+?)<p>~', '</p><p>$1</p><p>', $html); var_dump($html); // add into p the text after the last paragraph $html = preg_replace('~</p>((?!<p>).+)?$~Ds', '</p><p>$1</p>', $html, 1); var_dump($html); $html = preg_replace('~<p>(\W*)</p>~', '', $html); // $html = preg_replace('~^(<p>)?((?!</p>).*)(</p>)?$~A', '<p>$2</p>', $html); // if ($pPos = strpos($html, '<p>')) { // $html = '<p>' . substr($html, . '</p>'; // } // fix &nbsp; $html = html_entity_decode($html, null, 'UTF-8'); // change & to &amp; $html = preg_replace('/&(?!#?[a-z0-9]+;)/', '&amp;', $html); $paragraphPosition = strpos($html, '<p>'); if (0 !== $paragraphPosition) { $html = '<p>' . substr($html, 0, $paragraphPosition) . '</p>' . substr($html, $paragraphPosition); } var_dump($html);
Output for git.master, git.master_jit, rfc.property-hooks
string(159) "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>" string(159) "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>" string(159) "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>" string(159) "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>" string(159) "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>" string(166) "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p><p></p>" Deprecated: html_entity_decode(): Passing null to parameter #2 ($flags) of type int is deprecated in /in/igRGr on line 35 string(166) "<p>Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br></p><p><br></p>"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
63.89 ms | 404 KiB | 8 Q