3v4l.org

run code in 300+ PHP versions simultaneously
<?  //connect to your database //query comments for this page of this article $inf = "SELECT * FROM `comments` WHERE page = '".stripslashes($_SERVER['REQUEST_URI'])."' ORDER BY time ASC";  $info = mysql_query($inf);      if(!$info) die(mysql_error());    $info_rows = mysql_num_rows($info); if($info_rows > 0) {    echo '<h5>Comments:</h5>';    echo '<table width="95%">';      while($info2 = mysql_fetch_object($info)) {     echo '<tr>';    echo '<td>"'.stripslashes($info2->subject).'" by: <a href="'.$info2->contact.'">'.stripslashes($info2->username).'</a> </td> <td><div align="right"> @ '.date('h:i:s a', $info2->time).' on '.$info2->date.'</div></td>'; echo '</tr><tr>'; echo '<td colspan="2"> '.stripslashes($info2->comment).' </td>'; echo '</tr>'; }//end while echo '</table>'; echo '<hr width="95%" noshade>'; } else echo 'No comments for this page. Feel free to be the first <br>'; if(isset($_POST['submit'])) {   if(!addslashes($_POST['username'])) die('<u>ERROR:</u> you must enter a username to add a comment.');   if(!addslashes($_POST['contact']))  die('<u>ERROR:</u> enter contact method in contact field.');   if(!addslashes($_POST['subject']))  die('<u>ERROR:</u> enter a subject to your comment.');   if(!addslashes($_POST['comment']))  die('<u>ERROR:</u> cannot add comment if you do not enter one!?');  //this is for a valid contact    if(substr($_POST['contact'],0,7) != 'mailto:' && !strstr($_POST['contact'],'//')) {               if(strstr($_POST['contact'],'@'))                 $_POST['contact'] = "mailto:".$_POST['contact']."";               else                 $_POST['contact'] = "http://".$_POST['contact']."";    } //end valid contact //try to prevent multiple posts and flooding... $c = "SELECT * from `comments` WHERE ip = '".$_SERVER['REMOTE_ADDR']."'";   $c2 = mysql_query($c);      while($c3 = mysql_fetch_object($c2)) {       $difference = time() - $c3->time;      if($difference < 300) die('<u>ALERT:</u> '.$c3->username.', You have already commented earlier; if you have a question, try the forums!<BR>');       } //end while //add comment $q ="INSERT INTO `comments` (article_id, page, date, time, username, ip, contact, subject, comment)  VALUES ('".$_GET['id']."', '".$_POST['page']."', '".$_POST['date']."','".$_POST['time']."', '".addslashes(htmlspecialchars($_POST['username']))."',  '".$_SERVER['REMOTE_ADDR']."', '".addslashes(htmlspecialchars($_POST['contact']))."', '".addslashes(htmlspecialchars($_POST['subject']))."', '".addslashes(htmlspecialchars(nl2br($_POST['comment'])))."')"; $q2 = mysql_query($q);   if(!$q2) die(mysql_error()); //refresh page so they can see new comment header('Location: http://' . $_SERVER['HTTP_HOST'] . $_POST['page'] . "#comments"); } else {  //display form ?> <form name="comments" action="<? $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="page" value="<? echo($_SERVER['REQUEST_URI']); ?>"> <input type="hidden" name="date" value="<? echo(date("F j, Y.")); ?>"> <input type="hidden" name="time" value="<? echo(time()); ?>"> <table width="90%" border="0" cellspacing="0" cellpadding="0">    <tr>        <td><div align="right">Username:   </div></td>         <td><input name="username" type="text" size="30" value=""></td>    </tr>     <tr>        <td><div align="right">Contact:   </div></td>       <td><input type="text" name="contact" size="30" value=""> <i>(email or url)</i></td>     </tr>     <td><div align="right">Subject:   </div></td>     <td><input type="text" name="subject" size="30" value=""></td>     </tr>     <tr>       <td><div align="right">Comment:   </div></td>       <td><textarea name="comment" cols="45" rows="5" wrap="VIRTUAL"></textarea></td>     </tr>     <tr>        <td></td>       <td colspan="2"><input type="reset" value="Reset Fields">              <input type="submit" name="submit" value="Add Comment"></td>     </tr>   </table> </form> <? } // end else ?> 

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)
8.3.70.0120.00316.58
8.3.60.0100.00316.38
8.3.50.0140.00522.90
8.3.40.0060.01520.42
8.3.30.0070.00719.09
8.3.20.0070.00019.98
8.3.10.0000.00823.48
8.3.00.0080.00017.63
8.2.180.0090.00616.32
8.2.170.0070.00722.96
8.2.160.0030.01020.47
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0000.00821.15
8.2.110.0030.00621.05
8.2.100.0080.00417.72
8.2.90.0070.00319.09
8.2.80.0040.00417.97
8.2.70.0000.00817.38
8.2.60.0030.00617.93
8.2.50.0060.00318.10
8.2.40.0000.00718.03
8.2.30.0070.00017.82
8.2.20.0050.00317.46
8.2.10.0040.00418.01
8.2.00.0000.00717.47
8.1.280.0080.00825.92
8.1.270.0050.00323.91
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00722.29
8.1.230.0070.00317.70
8.1.220.0000.00717.74
8.1.210.0080.00018.77
8.1.200.0040.00417.10
8.1.190.0040.00417.10
8.1.180.0050.00318.10
8.1.170.0000.00718.52
8.1.160.0000.00721.87
8.1.150.0040.00318.71
8.1.140.0040.00417.39
8.1.130.0030.00317.73
8.1.120.0080.00017.24
8.1.110.0050.00317.35
8.1.100.0050.00217.38
8.1.90.0000.00717.30
8.1.80.0040.00417.38
8.1.70.0040.00417.21
8.1.60.0040.00417.47
8.1.50.0030.00517.29
8.1.40.0040.00417.22
8.1.30.0000.00817.50
8.1.20.0030.00617.55
8.1.10.0070.00017.31
8.1.00.0000.00717.37
8.0.300.0080.00019.88
8.0.290.0040.00416.58
8.0.280.0030.00318.34
8.0.270.0040.00417.12
8.0.260.0000.00617.25
8.0.250.0000.00716.88
8.0.240.0000.00816.88
8.0.230.0000.00716.81
8.0.220.0000.00716.77
8.0.210.0070.00016.76
8.0.200.0030.00316.82
8.0.190.0030.00516.76
8.0.180.0080.00016.68
8.0.170.0030.00616.80
8.0.160.0000.00716.86
8.0.150.0040.00416.73
8.0.140.0030.00316.63
8.0.130.0050.00313.44
8.0.120.0040.00416.73
8.0.110.0040.00416.80
8.0.100.0050.00216.71
8.0.90.0040.00416.69
8.0.80.0070.01116.72
8.0.70.0070.00016.65
8.0.60.0030.00616.84
8.0.50.0040.00416.88
8.0.30.0110.00917.08
8.0.20.0120.00617.40
8.0.10.0000.00716.91
8.0.00.0090.00916.64
7.4.330.0080.00015.14
7.4.320.0030.00316.41
7.4.300.0050.00216.27
7.4.290.0030.00316.38
7.4.280.0060.00316.48
7.4.270.0070.00016.40
7.4.260.0030.00516.27
7.4.250.0020.00516.49
7.4.240.0000.00716.35
7.4.230.0040.00416.50
7.4.220.0120.00616.43
7.4.210.0070.01316.59
7.4.200.0070.00016.55
7.4.160.0080.00816.32
7.4.150.0150.00317.40
7.4.140.0110.01017.86
7.4.130.0110.01016.47
7.4.120.0110.00616.31
7.4.110.0130.01016.37
7.4.100.0100.00716.22
7.4.90.0090.00916.29
7.4.80.0110.00719.39
7.4.70.0080.00916.54
7.4.60.0150.00316.43
7.4.50.0040.00416.16
7.4.40.0170.00016.36
7.4.30.0060.01116.59
7.3.330.0000.00513.22
7.3.320.0000.00513.00
7.3.310.0040.00415.99
7.3.300.0000.00716.13
7.3.290.0130.00516.16
7.3.280.0110.00516.19
7.3.270.0040.01317.40
7.3.260.0110.01216.45
7.3.250.0120.00716.45
7.3.240.0130.01016.13
7.3.230.0090.00616.39
7.3.210.0100.01316.39
7.3.200.0130.00319.39
7.3.190.0150.00616.45
7.3.180.0030.01316.32
7.3.170.0060.00916.28
7.3.160.0090.00916.27
7.2.330.0110.00716.38
7.2.320.0030.02216.22
7.2.310.0040.01216.39
7.2.300.0110.00616.39
7.2.290.0090.01216.20
5.4.320.0060.03712.46
5.4.310.0090.04012.46
5.4.300.0060.04112.46
5.4.290.0070.04312.45
5.4.280.0040.04112.35
5.4.270.0070.03812.35
5.4.260.0110.04212.35
5.4.250.0070.04512.36
5.4.240.0080.03512.36
5.4.230.0060.04112.34
5.4.220.0060.04512.34
5.4.210.0080.03612.34
5.4.200.0060.04612.34
5.4.190.0090.03512.34
5.4.180.0060.03812.34
5.4.170.0060.03912.35
5.4.160.0070.03712.35
5.4.150.0050.03812.35
5.4.140.0080.04212.03
5.4.130.0090.03912.02
5.4.120.0070.04511.97
5.4.110.0090.03711.97
5.4.100.0060.04111.97
5.4.90.0080.03811.97
5.4.80.0090.03811.97
5.4.70.0050.04211.97
5.4.60.0080.03711.97
5.4.50.0050.03511.97
5.4.40.0060.03511.96
5.4.30.0090.03311.95
5.4.20.0060.04011.95
5.4.10.0070.03911.95
5.4.00.0050.03711.45

preferences:
35.28 ms | 401 KiB | 5 Q