3v4l.org

run code in 300+ PHP versions simultaneously
<?php //this code shows friend suggestions. //************************************************************* // place $req_status any where it will show the button/msg etc //************************************************************* //$user_email = email@example.com // get id by matching email address $result = mysql_query("SELECT id FROM tbluser WHERE email = '$user_email'"); if (!$result) { echo 'Could not run query'; } $row = mysql_fetch_assoc($result); $user_id = $row['id']; // id of the user //logged in. I assumed that you have the user id and profile id as follows. //$_SESSION['user_id'] = $user_id; if($_GET['fid']){ // ---------------------------------------------------- $friend_id = $_GET['fid']; // profile user id. // it shows "Friends" if user is friend. or "Add friend" or "Request pending" $query1="SELECT * FROM friends WHERE (user_id = '$user_id' AND friend_id = '$friend_id') OR (friend_id = '$friend_id' AND user_id = '$user_id')"; $result = mysql_query($query1); $row = mysql_num_rows($result); if ($row == 1) { // exist, whether it's active or not while($row = mysql_fetch_assoc($result)) { if ($row['status'] == 1) { echo "Friends"; } elseif ($row['status'] == 0) { if($row['user_id'] == $user_id){ $req_status = "Request pending"; //echo "Request pending"; } elseif($user_id == $row['friend_id']) { $uid = $row["user_id"]; $req_status = '<a href="add_friend.php?fid='.$uid.'">Accept request</a> or <a href="ignore_request.php?fid='.$uid.'">Ignore</a>'; } } else { if($row['user_id'] == $user_id){ $req_status = "Request pending"; //echo "Request pending"; } else { $req_status = '<a href="add_friend.php?fid='.$friend_id.'">Add Friend</a>'; //echo "<a href='add_friend.php?fid=".$friend_id."'>Add Friend</a>"; } } } } else { // if the relationship don't exist $req_status = '<a href="add_friend.php?fid=$friend_id">Add friend</a>'; //echo "<a href='add_friend.php?fid=".$friend_id."'>Add friend</a>"; } // ---------------------------------------------------- } ?>

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.0070.00716.75
8.3.60.0080.00818.40
8.3.50.0260.00321.14
8.3.40.0140.00018.98
8.3.30.0100.00320.21
8.3.20.0040.00420.53
8.3.10.0050.00321.15
8.3.00.0080.00023.48
8.2.180.0090.00616.88
8.2.170.0140.00422.96
8.2.160.0070.00720.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0090.00021.00
8.2.110.0060.00319.14
8.2.100.0040.00717.78
8.2.90.0000.00819.17
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0030.00617.93
8.2.50.0030.00618.07
8.2.40.0040.00418.03
8.2.30.0040.00419.42
8.2.20.0070.00017.68
8.2.10.0070.00017.69
8.2.00.0050.00317.76
8.1.280.0040.01125.92
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0090.00028.09
8.1.240.0000.00922.45
8.1.230.0060.00620.90
8.1.220.0060.00318.77
8.1.210.0080.00018.92
8.1.200.0040.00417.13
8.1.190.0030.00617.39
8.1.180.0050.00518.10
8.1.170.0000.00818.59
8.1.160.0030.00318.77
8.1.150.0030.00618.44
8.1.140.0000.00817.38
8.1.130.0030.00317.76
8.1.120.0000.00717.26
8.1.110.0040.00417.30
8.1.100.0000.00717.40
8.1.90.0040.00417.38
8.1.80.0000.00717.39
8.1.70.0000.00717.33
8.1.60.0060.00317.46
8.1.50.0000.00717.43
8.1.40.0030.00517.39
8.1.30.0020.00517.49
8.1.20.0030.00517.56
8.1.10.0000.00717.46
8.1.00.0030.00617.35
8.0.300.0000.00819.90
8.0.290.0000.00717.18
8.0.280.0000.00718.32
8.0.270.0030.00317.12
8.0.260.0030.00316.71
8.0.250.0100.00016.95
8.0.240.0080.00017.01
8.0.230.0020.00517.03
8.0.220.0000.00816.86
8.0.210.0030.00316.92
8.0.200.0030.00317.01
8.0.190.0030.00516.93
8.0.180.0040.00416.87
8.0.170.0040.00316.94
8.0.160.0000.00716.96
8.0.150.0060.00316.87
8.0.140.0070.00016.91
8.0.130.0080.00013.30
8.0.120.0000.00816.75
8.0.110.0000.00816.96
8.0.100.0040.00416.80
8.0.90.0070.00016.95
8.0.80.0070.01016.91
8.0.70.0000.00816.71
8.0.60.0000.00716.87
8.0.50.0000.00716.76
8.0.30.0090.01017.11
8.0.20.0100.00917.40
8.0.10.0030.00517.08
8.0.00.0130.00816.75
7.4.330.0040.00014.93
7.4.320.0060.00016.41
7.4.300.0030.00316.60
7.4.290.0040.00416.60
7.4.280.0040.00416.54
7.4.270.0000.00716.45
7.4.260.0000.00613.27
7.4.250.0000.00816.43
7.4.240.0000.00716.55
7.4.230.0040.00416.37
7.4.220.0130.00616.57
7.4.210.0040.01216.56
7.4.200.0070.00016.34
7.4.190.0040.00416.51
7.4.160.0140.00316.21
7.4.150.0060.01317.40
7.4.140.0130.01017.86
7.4.130.0080.00916.46
7.4.120.0090.00816.46
7.4.110.0130.00316.45
7.4.100.0070.01416.52
7.4.90.0110.00816.55
7.4.80.0110.00719.39
7.4.70.0090.01116.54
7.4.60.0060.00916.55
7.4.50.0040.00416.57
7.4.40.0000.01622.77
7.4.30.0090.00716.43
7.4.00.0100.00314.94
7.3.330.0000.00513.22
7.3.320.0000.00613.22
7.3.310.0030.00316.26
7.3.300.0000.00716.20
7.3.290.0100.00716.22
7.3.280.0080.00716.34
7.3.270.0060.01517.40
7.3.260.0090.00918.24
7.3.250.0050.01216.49
7.3.240.0110.00716.26
7.3.230.0100.00716.39
7.3.210.0060.01116.28
7.3.200.0120.01019.39
7.3.190.0090.00916.18
7.3.180.0120.00916.46
7.3.170.0060.01016.27
7.3.160.0070.01016.52
7.3.120.0100.00615.12
7.2.330.0090.00916.59
7.2.320.0070.01016.52
7.2.310.0000.01716.68
7.2.300.0140.00316.27
7.2.290.0080.01116.26
7.2.60.0090.00616.64
7.2.00.0030.01219.26
7.1.200.0040.01115.38
7.1.70.0000.00716.80
7.1.60.0140.01019.17
7.1.50.0140.01734.77
7.1.00.0000.03722.54
7.0.200.0030.01416.44
7.0.140.0030.07322.00
7.0.70.0030.08021.61
7.0.60.0070.07721.66
7.0.50.0100.07322.13
7.0.40.0030.06020.13
7.0.30.0030.08320.10
7.0.20.0030.07320.02
7.0.10.0100.07320.03
7.0.00.0030.07720.14
5.6.280.0070.07020.79
5.6.220.0030.06720.57
5.6.210.0070.08020.38
5.6.200.0070.08721.05
5.6.190.0000.06721.04
5.6.180.0100.08020.94
5.6.170.0170.06721.18
5.6.160.0100.07321.05
5.6.150.0030.08320.94
5.6.140.0000.07321.17
5.6.130.0070.06321.02
5.6.120.0070.05721.02
5.6.110.0070.06321.02
5.6.100.0100.07021.12
5.6.90.0170.07321.02
5.6.80.0000.08320.34
5.6.70.0030.08320.46
5.6.60.0100.08020.39
5.6.50.0100.07020.45
5.6.40.0070.08020.44
5.6.30.0070.08320.41
5.6.20.0030.07320.37
5.6.10.0030.08020.49
5.6.00.0000.07020.28
5.5.360.0070.08320.34
5.5.350.0100.07320.41
5.5.340.0070.06720.84
5.5.330.0100.07020.83
5.5.320.0030.05720.79
5.5.310.0130.07020.93
5.5.300.0030.08320.88
5.5.290.0030.05720.87
5.5.280.0000.08020.86
5.5.270.0030.08320.91
5.5.260.0070.08020.80
5.5.250.0000.06720.62
5.5.240.0100.07720.15
5.5.230.0030.08020.14
5.5.220.0030.05720.23
5.5.210.0070.07020.23
5.5.200.0170.06720.07
5.5.190.0100.07720.15
5.5.180.0070.07320.18
5.5.160.0070.07320.27
5.5.150.0030.07720.23
5.5.140.0070.07020.14
5.5.130.0030.08320.15
5.5.120.0030.08020.28
5.5.110.0100.06320.24
5.5.100.0130.07320.09
5.5.90.0070.05320.02
5.5.80.0070.07319.94
5.5.70.0000.06020.06
5.5.60.0070.07320.11
5.5.50.0070.07020.05
5.5.40.0100.07020.16
5.5.30.0070.08020.03
5.5.20.0030.07020.13
5.5.10.0030.07720.09
5.5.00.0070.07719.96
5.4.450.0000.08319.43
5.4.440.0030.08019.11
5.4.430.0000.07719.42
5.4.420.0070.07719.22
5.4.410.0130.06019.44
5.4.400.0030.07018.79
5.4.390.0000.08319.10
5.4.380.0030.06018.78
5.4.370.0000.04719.04
5.4.360.0100.07019.23
5.4.350.0070.06019.13
5.4.340.0000.07719.12
5.4.320.0030.07719.03
5.4.310.0070.06718.96
5.4.300.0070.07019.09
5.4.290.0000.07019.05
5.4.280.0100.07719.02
5.4.270.0030.07018.81
5.4.260.0030.06318.78
5.4.250.0030.05718.83
5.4.240.0030.07019.05
5.4.230.0030.06319.05
5.4.220.0000.08319.04
5.4.210.0130.06719.09
5.4.200.0070.07719.22
5.4.190.0030.06018.76
5.4.180.0030.07019.13
5.4.170.0000.08018.95
5.4.160.0030.06018.95
5.4.150.0030.08718.96
5.4.140.0030.07016.32
5.4.130.0000.07316.23
5.4.120.0070.07316.27
5.4.110.0100.05016.25
5.4.100.0030.07316.32
5.4.90.0030.07016.33
5.4.80.0070.07316.24
5.4.70.0000.07316.25
5.4.60.0030.07316.28
5.4.50.0130.06716.19
5.4.40.0000.07716.45
5.4.30.0070.07316.18
5.4.20.0030.06316.20
5.4.10.0070.07716.40
5.4.00.0030.06015.66
5.3.290.0000.08714.54
5.3.280.0070.04314.45
5.3.270.0000.07314.61
5.3.260.0000.08314.58
5.3.250.0000.07714.48
5.3.240.0000.08314.58
5.3.230.0000.07014.43
5.3.220.0100.06014.59
5.3.210.0030.06714.55
5.3.200.0100.06714.44
5.3.190.0000.07314.56
5.3.180.0030.07314.43
5.3.170.0100.07014.51
5.3.160.0070.06714.43
5.3.150.0070.06714.54
5.3.140.0030.07314.53
5.3.130.0030.07314.40
5.3.120.0030.07014.55
5.3.110.0030.06314.42
5.3.100.0070.07314.01
5.3.90.0070.06714.04
5.3.80.0000.05713.78
5.3.70.0000.04713.99
5.3.60.0030.03313.92
5.3.50.0030.03313.71
5.3.40.0000.03713.94
5.3.30.0000.03713.93
5.3.20.0000.03713.56
5.3.10.0000.03313.63
5.3.00.0000.05013.61
5.2.170.0070.03011.00
5.2.160.0070.02311.21
5.2.150.0030.02710.95
5.2.140.0000.03011.22
5.2.130.0030.02711.10
5.2.120.0000.03310.94
5.2.110.0000.02310.93
5.2.100.0000.05311.13
5.2.90.0000.04310.91
5.2.80.0000.03010.90
5.2.70.0030.02711.09
5.2.60.0000.03011.02
5.2.50.0000.03010.99
5.2.40.0000.03010.96
5.2.30.0070.02310.78
5.2.20.0000.03010.77
5.2.10.0000.04710.93
5.2.00.0070.04710.79
5.1.60.0000.05710.01
5.1.50.0000.0539.89
5.1.40.0030.05310.02
5.1.30.0030.03710.30
5.1.20.0030.02710.44
5.1.10.0000.04010.12
5.1.00.0030.03010.14
5.0.50.0030.0308.64
5.0.40.0000.0238.64
5.0.30.0030.0238.64
5.0.20.0000.0208.64
5.0.10.0000.0208.64
5.0.00.0000.0378.64
4.4.90.0030.0208.64
4.4.80.0000.0178.64
4.4.70.0000.0208.64
4.4.60.0000.0208.64
4.4.50.0070.0208.64
4.4.40.0000.0578.64
4.4.30.0030.0138.64
4.4.20.0030.0138.64
4.4.10.0000.0178.64
4.4.00.0000.0338.64
4.3.110.0030.0108.64
4.3.100.0000.0178.64
4.3.90.0030.0138.64
4.3.80.0000.0238.64
4.3.70.0000.0208.64
4.3.60.0030.0178.64
4.3.50.0030.0208.64
4.3.40.0000.0308.64
4.3.30.0000.0178.64
4.3.20.0000.0178.64
4.3.10.0000.0178.64
4.3.00.0000.0178.64

preferences:
44.8 ms | 401 KiB | 5 Q