3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); //db include_once('db.php'); include_once 'time_stamp.php'; include_once 'tolink.php'; $user_email = $_SESSION['email']; //get id by matching email address $q4id = mysql_query("SELECT id FROM tbluser WHERE email = '$user_email'"); $row_id = mysql_fetch_assoc($q4id); $user_id = $row_id['id']; // id of the user //limit of group posts $i_limit='15'; //number of posts to show on a page if($_GET['next']){ $limit = $i_limit*$_GET['next']; $_i = ($_GET['next']-1)*$i_limit; } else { $limit=$i_limit; $_i='0'; } if($_GET['msg']){ echo "<span style='border-radius:5px;display:block;border:2px solid red;text-align:center;background:#cfc'> ".htmlentities($_GET['msg'])." </span>"; } if($_GET['id']){ echo "<link rel='stylesheet' type='text/css' href='groups.css' />"; $gid=$_GET['id']; $qcheck = mysql_query("SELECT * FROM groups WHERE id = '$gid'") or die("Error! Cheating the system is not tolerated here!"); $qgroupname = mysql_query("SELECT * FROM groups WHERE id = '$gid' AND active = '1'"); $ex = mysql_num_rows($qgroupname); if($ex==0){ echo "No such group exists!<br/>You may have clicked a wrong link or the group may have been deleted or suspended."; } else { $row_gname = mysql_fetch_array($qgroupname); //following are the variables to display group name and/or description. place them where u want $gdescription = $row_gname['description']; $gname = $row_gname['name']; $qgroups = mysql_query("SELECT * FROM groupmembers WHERE member = '$user_id' AND id = '$gid' AND flag = '1'"); $countgroups = mysql_num_rows($qgroups); if($countgroups == 0){ //user is not a member of group or is banned //place $msg to show the following msg, u may edit it. $msg="You are not a member of this group. Join this group"; //following is the link variable. u can appy css to it by editing it! $jl='<a href="join.php?id='.$gid.'">Join</a>'; } elseif($countgroups == 1){ //user is a member $query4admin = mysql_query("SELECT * FROM groups WHERE id = '$gid' AND admin = '$user_id'"); $admin = mysql_num_rows($query4admin); if($admin == 1){ //user is admin so it will display admin link, msg etc. u can edit! $msg="You are admin of this group"; $jl='<a href="admin.php?id='.$gid.'">Admin</a>'; } elseif($admin == 0){ //you can also customize these variables! $msg="You are a member of this group."; $jl='<a href="leave.php?id='.$gid.'">Leave</a>'; } ?> <div style="text-align:left;background-color:#FFFFFF;padding:10px;width:550px;"> <div id="updateboxarea" style="margin-bottom:20px;"> <h4>Share something</h4> <form method="post" action="post.php?id=<?=$gid?>" > <textarea cols="30" rows="4" name="message" id="update" maxlength="200" ></textarea> <br /> <input type="submit" value="Post" class="update_button"/> </form> </div> <?php $queryposts = mysql_query("SELECT * FROM groupmessages WHERE gid = '$gid' AND type = 'text' LIMIT $_i, $limit ") or die(mysql_error()); $posts = mysql_num_rows($queryposts); while($post = mysql_fetch_array($queryposts)){ $uid=$post['author']; $quser = mysql_query("SELECT * FROM tbluser WHERE id = '$uid'"); $row_user = mysql_fetch_assoc($quser); $user_name = $row_user['fname']." ".$row_user['lname']; $user_photo = $row_user['photo']; $user_photo="http://nitofa.com/user_pics/users/$user_photo"; $msg_id=$post['msg_id']; $message=$post['message']; $message=tolink(htmlentities($message)); $time=$post['created']; $q4 = mysql_query("SELECT * FROM groups WHERE id = '$gid' AND admin = '$user_id'"); $info = mysql_fetch_array($q4); $admin = mysql_num_rows($q4); if($admin == 1){ //if user is admin, than we will also show delete link! $del = '<a class="stdelete" href="delete.php?id='.$msg_id.'" id="'.$msg_id.'" title="Delete post">X</a>'; } elseif($uid==$user_id){ //if the post is by the user than delete link is shown also! $del = '<a class="stdelete" href="delete.php?id='.$msg_id.'" id="'.$msg_id.'" title="Delete post">X</a>'; } ?> <div class="stbody" id="stbody<?php echo $msg_id;?>"> <div class="stimg"> <img src="<?php echo $user_photo;?>" class='big_face'/> </div> <div class="sttext"> <?php if($del) { echo $del; } ?> <b><a href="<?php echo 'http://nitofa.com/browse-user.php?fid='.$uid;?>"><?php echo $user_name;?></a></b> <br/><?php echo $message;?> <div class="sttime"><?php time_stamp($time);?><!-- | <a href='#commentbox<?php echo $msg_id;?>' class='commentopen' id='<?php echo $msg_id;?>' title='Comment'>Comment </a> --></div> <div id="stexpandbox"> <div id="stexpand<?php echo $msg_id;?>"></div> </div> <div class="commentcontainer" id="commentload<?php echo $msg_id;?>"> <?php include('comments.php'); ?> </div> <div class="commentupdate" style='display:none;' id='commentbox<?php echo $msg_id;?>'> <div class="stcommentimg"> <img src="<?php echo $user_photo;?>" class='small_face'/> </div> <div class="stcommenttext" > <form method="post" action="comment.php"> <textarea name="comment" class="comment" maxlength="200" id="ctextarea<?php echo $msg_id;?>"></textarea> <br /> <input type="submit" value=" Comment " id="<?php echo $msg_id;?>" class="comment_button"/> </form> </div> </div> <!--close sttext--> </div> <!--close stbody--> </div> <?php } if(!$posts < $i_limit){ if(!$_GET['next']){ $page = '2'; } else { $page = $_GET['next']+1; } echo '<a style="text-align:center;margin:0 auto;" href="?id='.$gid.'&next='.$page.'">View More</a>'; } echo "</div>"; } } } else { //user joined groups $qgroups = mysql_query("SELECT * FROM groupmembers WHERE member = '$id'"); $countgroups = mysql_num_rows($qgroups); if ($countgroups == 0) { //u can make the following a variable by changing echo with $variablename= and place where u want echo "You have not joined any group yet."; } else { echo "<h2 id=\"groups\">Groups you have joined:</h2>"; while($groups = mysql_fetch_array($qgroups)){ $gid=$groups['id']; $qgroupname = mysql_query("SELECT name FROM groups WHERE id = '$gid' AND active = '1'"); $cq = mysql_num_rows($qgroupname); if($cq==0){ //group is deleted one so continue continue; } else { $row_gname = mysql_fetch_assoc($qgroupname); $gname = $row_gname['name']; echo "<a href='?id=".$gid."'>".$gname."</a><br/>"; } } } echo "<hr/>"; // user created groups $qmygroups = mysql_query("SELECT * FROM groups WHERE admin = '$user_id' AND active = '1'"); $countmygroups = mysql_num_rows($qmygroups); echo "<h2 id=\"mygroups\">Your Groups:</h2>"; if($countmygroups==0){ echo "You have not created any group yet!"; } else { while($mygroups = mysql_fetch_array($qmygroups)){ $gid=$mygroups['id']; $mygname=$mygroups['name']; echo "<a href='?id=".$gid."'>".$mygname."</a> &nbsp; - &nbsp; <a style='text-decoration:none;border-bottom:1px solid grey;font-size:small;' href='admin.php?id=".$gid."'>Admin</a><br/>"; } } } ?>

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.40.0120.00318.91
8.3.30.0120.00319.43
8.3.20.0070.00720.35
8.3.10.0080.00023.73
8.3.00.0040.00419.63
8.2.170.0060.01322.96
8.2.160.0090.00620.48
8.2.150.0110.00424.18
8.2.140.0090.00024.66
8.2.130.0070.01126.16
8.2.120.0040.01422.21
8.2.110.0030.00622.37
8.2.100.0080.00417.97
8.2.90.0050.00319.33
8.2.80.0040.00418.15
8.2.70.0060.00317.75
8.2.60.0090.00017.90
8.2.50.0090.00018.07
8.2.40.0050.00318.25
8.2.30.0090.00018.34
8.2.20.0060.00318.02
8.2.10.0030.00518.40
8.2.00.0040.00417.92
8.1.270.0040.00823.96
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0100.00023.84
8.1.230.0080.00419.35
8.1.220.0050.00317.88
8.1.210.0030.00518.77
8.1.200.0070.00317.61
8.1.190.0000.00817.65
8.1.180.0030.00618.10
8.1.170.0030.00918.62
8.1.160.0040.00422.13
8.1.150.0050.00218.81
8.1.140.0030.00617.59
8.1.130.0000.00718.05
8.1.120.0070.00017.63
8.1.110.0030.00517.66
8.1.100.0080.00017.60
8.1.90.0000.00817.58
8.1.80.0040.00417.58
8.1.70.0040.00417.54
8.1.60.0060.00317.71
8.1.50.0030.00517.78
8.1.40.0050.00317.68
8.1.30.0030.00617.72
8.1.20.0000.00817.91
8.1.10.0040.00417.88
8.1.00.0000.00817.63
8.0.300.0000.00818.77
8.0.290.0040.00417.54
8.0.280.0000.00718.59
8.0.270.0040.00417.45
8.0.260.0030.00317.18
8.0.250.0000.00717.23
8.0.240.0030.00617.21
8.0.230.0040.00417.31
8.0.220.0030.00317.27
8.0.210.0030.00517.11
8.0.200.0000.00717.21
8.0.190.0070.00017.24
8.0.180.0000.00717.12
8.0.170.0030.00617.18
8.0.160.0050.00217.18
8.0.150.0040.00417.08
8.0.140.0040.00417.13
8.0.130.0060.00013.60
8.0.120.0030.00617.15
8.0.110.0020.00517.10
8.0.100.0040.00417.06
8.0.90.0040.00417.23
8.0.80.0130.00617.15
8.0.70.0040.00417.09
8.0.60.0040.00417.03
8.0.50.0030.00517.20
8.0.30.0070.01317.33
8.0.20.0140.00817.42
8.0.10.0030.00517.16
8.0.00.0100.00917.07
7.4.330.0060.00015.02
7.4.320.0000.00716.69
7.4.300.0030.00316.68
7.4.290.0050.00216.81
7.4.280.0040.00416.76
7.4.270.0030.00316.63
7.4.260.0080.00016.64
7.4.250.0030.00616.64
7.4.240.0040.00416.70
7.4.230.0040.00416.85
7.4.220.0060.01316.82
7.4.210.0080.00816.77
7.4.200.0000.00716.86
7.4.190.0080.00016.66
7.4.160.0200.00316.74
7.4.150.0130.00617.40
7.4.140.0170.00217.86
7.4.130.0100.00816.72
7.4.120.0120.00616.76
7.4.110.0090.00916.57
7.4.100.0110.00716.71
7.4.90.0090.00916.73
7.4.80.0110.00819.39
7.4.70.0130.00416.79
7.4.60.0110.00616.64
7.4.50.0040.00416.51
7.4.40.0070.01022.77
7.4.30.0110.00616.68
7.4.10.0130.00715.15
7.4.00.0080.01215.00
7.3.330.0000.00613.28
7.3.320.0060.00013.50
7.3.310.0050.00316.62
7.3.300.0040.00416.53
7.3.290.0090.00616.50
7.3.280.0110.00516.56
7.3.270.0150.00317.40
7.3.260.0120.00616.52
7.3.250.0110.01316.44
7.3.240.0150.00916.52
7.3.230.0120.00616.69
7.3.210.0070.01816.59
7.3.200.0120.00916.73
7.3.190.0090.00916.52
7.3.180.0080.00816.63
7.3.170.0070.01016.61
7.3.160.0100.00716.61
7.3.130.0100.01014.67
7.3.120.0080.00915.00
7.3.110.0120.00814.88
7.3.100.0050.01115.03
7.3.90.0080.00614.79
7.3.80.0050.00815.08
7.3.70.0090.00615.00
7.3.60.0060.00714.90
7.3.50.0100.00714.91
7.3.40.0090.00814.85
7.3.30.0100.00514.98
7.3.20.0020.01016.67
7.3.10.0020.01016.58
7.3.00.0050.00816.35
7.2.330.0120.00916.73
7.2.320.0110.01216.74
7.2.310.0040.01416.97
7.2.300.0060.01216.94
7.2.290.0120.00617.04
7.2.260.0100.00614.82
7.2.250.0070.01115.17
7.2.240.0110.00815.09
7.2.230.0060.01015.24
7.2.220.0070.00615.39
7.2.210.0050.01015.29
7.2.200.0070.00915.04
7.2.190.0060.00615.17
7.2.180.0050.00715.03
7.2.170.0050.01214.83
7.2.160.0000.01114.90
7.2.150.0060.01016.80
7.2.140.0030.01016.59
7.2.130.0060.00616.59
7.2.120.0120.00416.70
7.2.110.0030.01016.99
7.2.100.0060.00916.95
7.2.90.0040.01217.03
7.2.80.0040.01116.76
7.2.70.0060.00317.07
7.2.60.0030.01016.96
7.2.50.0110.00716.90
7.2.40.0130.00316.77
7.2.30.0060.00616.90
7.2.20.0000.01016.75
7.2.10.0070.00716.71
7.2.00.0030.01218.13
7.1.330.0110.00415.74
7.1.320.0070.00515.37
7.1.310.0050.00815.79
7.1.300.0070.00715.63
7.1.290.0070.00515.71
7.1.280.0060.00815.64
7.1.270.0050.00915.77
7.1.260.0060.00415.63
7.1.250.0050.00515.75
7.1.240.0060.00315.90
7.1.230.0040.01115.85
7.1.220.0070.00715.73
7.1.210.0080.00415.61
7.1.200.0040.00815.78
7.1.190.0060.00915.65
7.1.180.0120.00615.88
7.1.170.0120.00315.73
7.1.160.0120.00415.54
7.1.150.0040.00815.91
7.1.140.0030.00815.95
7.1.130.0030.00615.82
7.1.120.0000.00815.87
7.1.110.0100.00015.81
7.1.100.0100.00617.10
7.1.90.0040.01115.41
7.1.80.0110.00015.68
7.1.70.0020.00816.54
7.1.60.0020.01417.57
7.1.50.0020.01416.46
7.1.40.0060.00615.89
7.1.30.0000.01015.43
7.1.20.0090.00615.59
7.1.10.0060.00315.66
7.1.00.0100.03719.08
7.0.330.0030.01015.07
7.0.320.0000.01415.37
7.0.310.0060.00314.99
7.0.300.0140.00015.34
7.0.290.0080.00615.02
7.0.280.0140.00015.27
7.0.270.0050.00515.28
7.0.260.0050.00515.26
7.0.250.0030.01015.33
7.0.240.0040.00815.34
7.0.230.0060.00615.41
7.0.220.0070.01015.38
7.0.210.0030.00915.27
7.0.200.0000.00916.05
7.0.190.0000.01415.28
7.0.180.0070.00415.36
7.0.170.0040.00715.32
7.0.160.0030.00915.42
7.0.150.0000.01315.07
7.0.140.0050.03618.66
7.0.130.0040.00815.50
7.0.120.0040.00715.18
7.0.110.0000.01315.42
7.0.100.0050.02317.68
7.0.90.0130.02617.69
7.0.80.0030.02817.69
7.0.70.0070.02517.71
7.0.60.0020.02717.61
7.0.50.0050.04517.87
7.0.40.0050.04016.83
7.0.30.0030.02216.60
7.0.20.0070.02316.68
7.0.10.0030.02816.66
7.0.00.0060.02416.68
5.6.400.0060.00314.67
5.6.390.0160.00014.29
5.6.380.0030.00614.44
5.6.370.0090.00313.94
5.6.360.0000.00914.16
5.6.350.0100.00714.29
5.6.340.0030.01214.54
5.6.330.0000.01114.64
5.6.320.0040.01114.34
5.6.310.0060.00614.46
5.6.300.0030.01414.58
5.6.290.0040.01114.09
5.6.280.0040.03917.63
5.6.270.0030.01014.27
5.6.260.0070.00714.54
5.6.250.0050.02817.48
5.6.240.0080.02017.62
5.6.230.0070.02317.50
5.6.220.0020.02417.53
5.6.210.0020.03417.49
5.6.200.0070.02817.70
5.6.190.0030.04217.79
5.6.180.0030.03317.65
5.6.170.0040.02717.59
5.6.160.0030.02517.68
5.6.150.0070.02117.70
5.6.140.0030.02817.68
5.6.130.0090.01917.57
5.6.120.0070.02417.64
5.6.110.0040.04017.61
5.6.100.0070.02317.58
5.6.90.0120.02017.67
5.6.80.0080.02017.35
5.6.70.0030.02517.49
5.6.60.0050.02417.22
5.6.50.0060.02317.43
5.6.40.0020.02617.32
5.6.30.0000.02917.36
5.6.20.0040.04117.29
5.6.10.0070.04317.41
5.6.00.0050.03517.36
5.5.380.0050.02517.39
5.5.370.0130.01917.42
5.5.360.0020.02517.22
5.5.350.0100.02717.23
5.5.340.0060.02017.72
5.5.330.0030.02517.53
5.5.320.0050.02317.28
5.5.310.0070.02417.52
5.5.300.0030.03417.57
5.5.290.0070.02217.26
5.5.280.0000.02817.55
5.5.270.0020.02817.39
5.5.260.0060.03017.71
5.5.250.0040.03417.44
5.5.240.0090.02216.98
5.5.230.0060.02717.08
5.5.220.0050.02317.19
5.5.210.0110.02017.31
5.5.200.0070.02217.05
5.5.190.0070.02917.08
5.5.180.0050.02317.04
5.5.170.0030.00913.83
5.5.160.0030.04617.21
5.5.150.0080.04517.05
5.5.140.0050.04017.09
5.5.130.0070.04217.24
5.5.120.0100.04317.24
5.5.110.0100.04217.12
5.5.100.0030.03517.15
5.5.90.0040.04417.19
5.5.80.0060.04317.04
5.5.70.0040.03317.11
5.5.60.0010.04217.18
5.5.50.0070.05117.26
5.5.40.0080.03217.03
5.5.30.0040.02917.17
5.5.20.0030.03717.06
5.5.10.0080.03616.93
5.5.00.0050.04416.98
5.4.450.0060.02015.07
5.4.440.0040.02215.29
5.4.430.0020.02815.20
5.4.420.0090.01815.29
5.4.410.0050.02014.98
5.4.400.0050.02115.09
5.4.390.0040.02015.16
5.4.380.0050.01915.05
5.4.370.0030.02115.00
5.4.360.0060.02015.05
5.4.350.0050.03215.03
5.4.340.0040.02115.08
5.4.330.0070.00711.09
5.4.320.0050.02814.94
5.4.310.0050.02614.93
5.4.300.0100.03714.90
5.4.290.0030.03814.99
5.4.280.0030.04315.06
5.4.270.0080.03714.98
5.4.260.0030.04515.02
5.4.250.0050.02815.01
5.4.240.0070.03715.09
5.4.230.0070.04014.74
5.4.220.0080.03515.06
5.4.210.0020.05015.05
5.4.200.0020.02714.95
5.4.190.0070.03714.92
5.4.180.0020.04115.10
5.4.170.0000.04014.84
5.4.160.0050.02815.05
5.4.150.0060.03014.70
5.4.140.0020.03913.62
5.4.130.0030.03713.60
5.4.120.0050.04513.54
5.4.110.0070.03713.65
5.4.100.0100.02813.58
5.4.90.0050.04013.71
5.4.80.0070.03013.56
5.4.70.0050.02713.76
5.4.60.0060.02313.60
5.4.50.0070.03813.59
5.4.40.0090.03413.66
5.4.30.0020.04313.62
5.4.20.0070.03513.60
5.4.10.0050.02113.66
5.4.00.0030.02113.45
5.3.290.0070.04312.64
5.3.280.0080.04112.39
5.3.270.0020.03312.57
5.3.260.0050.03712.53
5.3.250.0030.04412.59
5.3.240.0080.02312.56
5.3.230.0030.02512.56
5.3.220.0010.04012.46
5.3.210.0040.03912.57
5.3.200.0020.02512.59
5.3.190.0030.02312.57
5.3.180.0030.02312.63
5.3.170.0070.03912.64
5.3.160.0020.04412.63
5.3.150.0070.03812.64
5.3.140.0060.03812.46
5.3.130.0000.04312.56
5.3.120.0050.04212.58
5.3.110.0040.03912.56
5.3.100.0050.03912.27
5.3.90.0060.03112.32
5.3.80.0080.03712.22
5.3.70.0050.04212.17
5.3.60.0050.02312.15
5.3.50.0060.03912.25
5.3.40.0070.03912.20
5.3.30.0020.02712.14
5.3.20.0070.04012.07
5.3.10.0050.03612.00
5.3.00.0100.03211.96

preferences:
48.67 ms | 400 KiB | 5 Q