3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Get real file from code id */ // nl2p // This function will convert newlines to HTML paragraphs // without paying attention to HTML tags. Feed it a raw string and it will // simply return that string sectioned into HTML paragraphs function nl2p($str) { $arr=explode("\n",$str); $out=''; for($i=0;$i<count($arr);$i++) { if(strlen(trim($arr[$i]))>0) $out.='<p>'.trim($arr[$i]).'</p>'; } return $out; } // nl2p_html // This function will add paragraph tags around textual content of an HTML file, leaving // the HTML itself intact // This function assumes that the HTML syntax is correct and that the '<' and '>' characters // are not used in any of the values for any tag attributes. If these assumptions are not met, // mass paragraph chaos may ensue. Be safe. function nl2p_html($str) { // If we find the end of an HTML header, assume that this is part of a standard HTML file. Cut off everything including the // end of the head and save it in our output string, then trim the head off of the input. This is mostly because we don't // want to surrount anything like the HTML title tag or any style or script code in paragraph tags. if(strpos($str,'</head>')!==false) { $out=substr($str,0,strpos($str,'</head>')+7); $str=substr($str,strpos($str,'</head>')+7); } } // test $string = "Submissions found to be in violation of these rules may be removed and the author's account suspended at the discretion of the site administrators and/or moderators. The site administrators reserve the right to modify these rules as needed."; $para = nl2p($string); echo $para; ?>
Output for git.master, git.master_jit, rfc.property-hooks
<p>Submissions found to be in violation of these rules may be removed and the author's account suspended at the discretion of the site administrators and/or moderators. The site administrators reserve the right to modify these rules as needed.</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:
58.33 ms | 401 KiB | 8 Q