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 = "<p> We want this to be a fun place where we share our love of genre. We just have a few rules. </p> <ol> <li>All fiction submitted to this site is subject to the disclaimers as shown. Specific to fan fiction, all such work is posted with the understanding that all copyrighted materials are the property of their respective creators and/or owners.</li> <li>Stories must be submitted to the proper category. If there is an appropriate sub-category, <strong>DO NOT</strong> add your story to the main category.</li> <li>Titles and summaries must be suitable general audiences (including children). No exceptions. Keep the "mature content" within the actual chapters themselves, thank you.</li> <li>A number of authors have requested that fans refrain from writing fan fiction based on their work. Therefore submissions will not be accepted based on the works of P.N. Elrod, Raymond Feist, Terry Goodkind, Laurell K. Hamilton, Anne McCaffrey, Robin McKinley, Irene Radford, Anne Rice, and Nora Roberts/J.D. Robb. This list will be revised as needed.</li> <li>Correct grammar and spelling are expected of all stories submitted to this site. The site administrators are not grammar Nazis. However, the site administrators reserve the right to request corrections in submissions with a multitude of grammar and/or spelling errors. If such a request is ignored, the story will be deleted.</li> <li>All stories must be rated correctly and have the appropriate warnings. All adult rated stories are expected to have warnings. After all, they wouldn't have that rating if there wasn't something to be warned about! The site administrators recognize that there is an audience for these stories, but please respect those who do not wish to read them by labeling them appropriately.</li> <li><strong>The following stories are NEVER allowed within this archive - so don't even ask:</strong> <ul> <li>Real person (i.e., actor/actress, band, singer, etc.) fiction</li> <li>Sex with minors</li> <li>Beastiality/zoophilia (NOTE: This specifically refers to NON-SENTIENT creatures - we understand that in the realm of science fiction and fantasy there are creatures who may have animalistic appearances who are indeed self-aware, intelligent and conscious)</li> <li>Script Format - Fiction is expected to be in narrative format. Also, there have been many instances of scripts posted on the web that later lead to lawsuits and other such unpleasantness (come on, if you write a script, and then a TV show or movie appears that is very similar, you know you're gonna ask questions). How about we avoid problems all together and just not do it, okay?</li> <li>Slash - The reason slash is specifically disallowed is because, by its definition, slash is the romantic and/or sexual pairing of characters in relationships that go against the established canon of their respective universes. The most (in)famous examples include Kirk/Spock, Han/Luke, Frodo/Sam, Josef/Mick, etc. To be brief, these kinds of pairings are akin to describing Luke Skywalker as a dark-eyed brunette, or claiming that Captain Jack Harkness (Torchwood) is heterosexual. A character's sexual orientation (at least as portrayed in canon material) is as intrinsic as eye color, hair color, height, etc. - in otherwords, an immutable quality that, if changed, has changed the essence of the character himself or herself. We absolutely have no problem with LGBT pairings and relationships - just do it with your own original characters unless otherwise established in the canon material.</li> </ul> </li> <li>Stories with multiple chapters should be archived as such and NEVER as separate stories. Simply create a new story, and add chapters to it. If you have trouble with this, please contact the site administrator or ask a friend to help you.</li> <li>Spoiler warnings are <strong>mandatory</strong> for all stories that pertain to current books, television series or movies (i.e., books that have been out less than six months, television series that are still in production, and films that are still in first release in a movie theater).An appropriate spoiler warning to place in your summary would be: Spoilers for Star Trek II: The Wrath of Khan.<strong>DO NOT</strong> do anything like this: Spoilers for the one where Spock dies.</li> </ol> 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; ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.5.90.0230.07319.23
5.5.80.0300.06719.57
5.5.70.0300.07019.56
5.5.60.0070.05319.23
5.5.50.0270.03719.22
5.5.40.0300.07019.46
5.5.30.0270.07319.21
5.5.20.0230.07319.48
5.5.10.0370.06019.37
5.5.00.0230.04319.47
5.4.250.0330.03718.85
5.4.240.0170.07018.92
5.4.230.0300.04318.92
5.4.220.0270.06718.92
5.4.210.0270.06719.14
5.4.200.0270.07019.25
5.4.190.0300.06318.86
5.4.180.0170.06318.91
5.4.170.0300.07318.86
5.4.160.0270.04018.91
5.4.150.0230.06318.99
5.4.140.0130.05716.55
5.4.130.0200.03716.36
5.4.120.0170.04316.48
5.4.110.0130.04716.46
5.4.100.0230.04716.43
5.4.90.0100.04016.72
5.4.80.0130.03316.71
5.4.70.0200.06716.43
5.4.60.0200.07016.45
5.4.50.0200.03716.39
5.4.40.0300.05016.37
5.4.30.0230.05016.26
5.4.20.0200.06316.41
5.4.10.0170.06016.42
5.4.00.0270.05015.77
5.3.280.0230.04714.76
5.3.270.0200.04314.67
5.3.260.0200.07714.66
5.3.250.0370.07714.62
5.3.240.0170.04714.61
5.3.230.0270.07314.65
5.3.220.0200.03714.60
5.3.210.0230.07714.61
5.3.200.0200.06714.64
5.3.190.0170.04014.46
5.3.180.0130.03714.49
5.3.170.0100.04014.59
5.3.160.0270.05014.61
5.3.150.0170.03314.57
5.3.140.0000.05714.59
5.3.130.0300.05314.61
5.3.120.0330.06314.58
5.3.110.0130.04014.56
5.3.100.0200.04014.12
5.3.90.0130.07014.08
5.3.80.0170.07314.02
5.3.70.0130.04714.18
5.3.60.0130.07014.02
5.3.50.0200.07013.95
5.3.40.0130.06713.98
5.3.30.0230.06713.93
5.3.20.0200.04313.86
5.3.10.0130.04313.81
5.3.00.0130.03313.66

preferences:
137.76 ms | 1394 KiB | 7 Q