3v4l.org

run code in 300+ PHP versions simultaneously
// viewprofiles.php <?php include_once("header.php"); echo $user.' is currently logged in<br><br>'; echo <<<_END <form method="post" action="viewprofiles.php"><pre> <input type="submit" name ="choice" value="LIKE" /> <input type="submit" name ="choice" value="NEXT PROFILE" /> </pre></form> _END; $allusers = array(); //Create the $allusers array, comprised of all users except me $result = queryMysql("SELECT * FROM members"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); if ($row[0] == $user) continue; $allusers[$j] = $row[0]; } //Create the $i_like_these_users array, comprised of all users i liked $result = queryMysql("SELECT * FROM likeprofile WHERE user='$user'"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); $i_like_these_users[$j] = $row[1]; } //Create the $i_dislike_these_users array, comprised of all users i disliked $result = queryMysql("SELECT * FROM dislikeprofile WHERE user='$user'"); $num = mysql_num_rows($result); for ($j = 0 ; $j < $num ; ++$j) { $row = mysql_fetch_row($result); $i_dislike_these_users[$j] = $row[1]; } //Create the $usersiviewed array, comprised of all users i have either liked or disliked if (is_array($i_like_these_users) && is_array($i_dislike_these_users)) { $usersiviewed = array_merge($i_like_these_users,$i_dislike_these_users); } elseif(is_array($i_like_these_users)) { $usersiviewed = $i_like_these_users; } else { $usersiviewed = $i_dislike_these_users; } // this removes from the array $allusers (i.e., profiles i can view) all $usersviewed (i.e., all the profiles i have already either liked/disliked) if (is_array($usersiviewed)) { $peopleicanview = array_diff($allusers, $usersiviewed); $peopleicanview = array_values($peopleicanview); // this re-indexes the array } else { $peopleicanview = $allusers; $peopleicanview = array_values($peopleicanview); // this re-indexes the array } $current_user_profile = $peopleicanview[0]; echo 'check out '.$current_user_profile.'s picture <br />'; if (file_exists("$current_user_profile.jpg")) {echo "<img src='$current_user_profile.jpg' align='left' />";} // if i like or dislike this person, the likeprofile or dislikeprofile table is updated with my name and the name of the person who liked or disliked if (isset($_POST['choice']) && $_POST['choice'] == 'LIKE') { $ilike = $current_user_profile; $query = "INSERT INTO likeprofile VALUES" . "('$user', '$ilike')"; if (!queryMysql($query)) echo "INSERT failed: $query<br />" . mysql_error() . "<br /><br />"; } if (isset($_POST['choice']) && $_POST['choice'] == 'NEXT PROFILE') { $idontlike = $current_user_profile; $query = "INSERT INTO dislikeprofile VALUES" . "('$user', '$idontlike')"; if (!queryMysql($query)) echo "INSERT failed: $query<br />" . mysql_error() . "<br /><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.70.0090.00917.00
8.3.60.0150.00318.31
8.3.50.0120.00821.14
8.3.40.0110.00418.96
8.3.30.0040.01119.18
8.3.20.0040.00420.34
8.3.10.0030.00521.92
8.3.00.0040.00422.34
8.2.190.0110.00417.00
8.2.180.0090.00616.75
8.2.170.0150.00622.96
8.2.160.0040.01119.33
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0070.01126.16
8.2.120.0040.00717.50
8.2.110.0000.00822.31
8.2.100.0000.01218.22
8.2.90.0000.00819.27
8.2.80.0040.00418.16
8.2.70.0080.00017.49
8.2.60.0000.00817.93
8.2.50.0060.00318.07
8.2.40.0000.00818.16
8.2.30.0040.00418.12
8.2.20.0040.00417.89
8.2.10.0050.00517.75
8.2.00.0000.00917.87
8.1.280.0060.00925.92
8.1.270.0000.00922.18
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0100.00023.79
8.1.230.0090.00319.01
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0090.00017.47
8.1.190.0050.00317.55
8.1.180.0050.00318.87
8.1.170.0080.00018.62
8.1.160.0040.00422.24
8.1.150.0060.00318.74
8.1.140.0070.00017.54
8.1.130.0070.00417.93
8.1.120.0000.00817.60
8.1.110.0040.00417.52
8.1.100.0080.00017.39
8.1.90.0000.00817.51
8.1.80.0000.00717.55
8.1.70.0030.00317.47
8.1.60.0000.00817.70
8.1.50.0000.00717.55
8.1.40.0000.00917.53
8.1.30.0000.00817.72
8.1.20.0000.00817.79
8.1.10.0040.00417.73
8.1.00.0060.00317.66
8.0.300.0040.00418.77
8.0.290.0000.00717.43
8.0.280.0000.00718.57
8.0.270.0030.00317.37
8.0.260.0030.00316.88
8.0.250.0030.00317.14
8.0.240.0000.01017.13
8.0.230.0000.00817.09
8.0.220.0040.00416.96
8.0.210.0000.00717.10
8.0.200.0000.00617.09
8.0.190.0040.00417.03
8.0.180.0000.00717.05
8.0.170.0040.00417.01
8.0.160.0000.00817.04
8.0.150.0000.00716.95
8.0.140.0060.00317.06
8.0.130.0060.00013.49
8.0.120.0080.00017.01
8.0.110.0000.00717.05
8.0.100.0000.00817.11
8.0.90.0040.00416.95
8.0.80.0140.00017.10
8.0.70.0030.00617.12
8.0.60.0000.00717.19
8.0.50.0040.00417.13
8.0.30.0080.01117.09
8.0.20.0090.01017.40
8.0.10.0000.00717.17
8.0.00.0090.01216.80
7.4.330.0000.00515.02
7.4.320.0030.00316.57
7.4.300.0030.00316.51
7.4.290.0070.00016.54
7.4.280.0050.00216.56
7.4.270.0000.00716.65
7.4.260.0100.00016.65
7.4.250.0040.00416.63
7.4.240.0050.00316.63
7.4.230.0000.00716.45
7.4.220.0070.01016.59
7.4.210.0080.00616.66
7.4.200.0000.00716.37
7.4.190.0040.00416.80
7.4.160.0120.00316.57
7.4.150.0150.00317.40
7.4.140.0100.01117.86
7.4.130.0090.01316.66
7.4.120.0120.00716.79
7.4.110.0120.00616.79
7.4.100.0180.00416.75
7.4.90.0140.00416.68
7.4.80.0100.01319.39
7.4.70.0090.01116.63
7.4.60.0140.00316.61
7.4.50.0040.00416.70
7.4.40.0050.01122.77
7.4.30.0060.00916.58
7.4.10.0030.01314.93
7.4.00.0080.00815.21
7.3.330.0050.00013.35
7.3.320.0060.00013.29
7.3.310.0070.00016.38
7.3.300.0000.00716.28
7.3.290.0070.00716.38
7.3.280.0090.00916.53
7.3.270.0100.01417.40
7.3.260.0130.00416.42
7.3.250.0100.00716.49
7.3.240.0120.00616.49
7.3.230.0110.00616.39
7.3.210.0070.01016.59
7.3.200.0130.00919.39
7.3.190.0030.02016.39
7.3.180.0060.00916.41
7.3.170.0130.00316.45
7.3.160.0180.00416.44
7.3.130.0100.00714.99
7.3.120.0050.01214.90
7.3.110.0120.00314.76
7.3.100.0030.00914.84
7.3.90.0100.00014.92
7.3.80.0070.00714.96
7.3.70.0000.00914.99
7.3.60.0070.00714.82
7.3.50.0120.00314.89
7.3.40.0070.01015.00
7.3.30.0090.00014.58
7.3.20.0070.00316.77
7.3.10.0070.00716.70
7.3.00.0070.00716.80
7.2.330.0160.00316.63
7.2.320.0130.01016.48
7.2.310.0070.01016.69
7.2.300.0070.01016.87
7.2.290.0030.01416.56
7.2.260.0030.01515.30
7.2.250.0000.01815.13
7.2.240.0150.00014.77
7.2.230.0000.01415.01
7.2.220.0100.00714.79
7.2.210.0060.00915.11
7.2.200.0040.01115.27
7.2.190.0040.01114.87
7.2.180.0030.01414.82
7.2.170.0100.00314.97
7.2.160.0040.00815.23
7.2.150.0060.01016.92
7.2.140.0130.00316.92
7.2.130.0030.01016.91
7.2.120.0030.01016.94
7.2.110.0030.00716.86
7.2.100.0090.00616.86
7.2.90.0070.00716.90
7.2.80.0030.01416.73
7.2.70.0040.00716.64
7.2.60.0020.01116.93
7.2.50.0030.00916.79
7.2.40.0060.00616.89
7.2.30.0040.01117.03
7.2.20.0110.00716.75
7.2.10.0030.01216.94
7.2.00.0070.00818.28
7.1.330.0060.00615.87
7.1.320.0040.01115.58
7.1.310.0100.00615.47
7.1.300.0110.00715.72
7.1.290.0100.00715.92
7.1.280.0040.01115.71
7.1.270.0070.00715.72
7.1.260.0060.00315.77
7.1.250.0080.00515.60
7.1.240.0070.00715.92
7.1.230.0060.00915.81
7.1.220.0000.00915.80
7.1.210.0000.01515.86
7.1.200.0070.00615.57
7.1.190.0110.00415.73
7.1.180.0120.00615.34
7.1.170.0090.00615.81
7.1.160.0030.00915.77
7.1.150.0080.00415.68
7.1.140.0070.00715.76
7.1.130.0090.00615.53
7.1.120.0040.01115.75
7.1.110.0060.00315.78
7.1.100.0100.00216.94
7.1.90.0000.00815.83
7.1.80.0040.00815.66
7.1.70.0060.00416.30
7.1.60.0060.01017.79
7.1.50.0060.00416.41
7.1.40.0040.00715.40
7.1.30.0060.00315.83
7.1.20.0030.00915.68
7.1.10.0060.00615.69
7.1.00.0030.03719.01
7.0.330.0100.00315.37
7.0.320.0040.01115.25
7.0.310.0040.01115.38
7.0.300.0080.00615.23
7.0.290.0000.01415.52
7.0.280.0070.00715.53
7.0.270.0120.00315.10
7.0.260.0040.01115.54
7.0.250.0000.01315.54
7.0.240.0070.00715.23
7.0.230.0000.00815.47
7.0.220.0100.00315.54
7.0.210.0030.00715.23
7.0.200.0060.00615.97
7.0.190.0000.01015.32
7.0.180.0050.00515.57
7.0.170.0090.00315.23
7.0.160.0030.00615.42
7.0.150.0070.01015.41
7.0.140.0050.03718.84
7.0.130.0080.00415.49
7.0.120.0060.00615.15
7.0.110.0070.00715.23
7.0.100.0120.00015.30
7.0.90.0000.01015.55
7.0.80.0030.00615.47
7.0.70.0090.03918.58
7.0.60.0050.04318.57
7.0.50.0080.04318.75
7.0.40.0080.04216.88
7.0.30.0030.02316.57
7.0.20.0020.05016.77
7.0.10.0090.04016.78
7.0.00.0040.04716.60
5.6.400.0060.00314.55
5.6.390.0000.00914.43
5.6.380.0040.01114.38
5.6.370.0080.00814.34
5.6.360.0090.00914.20
5.6.350.0100.00314.59
5.6.340.0150.00414.36
5.6.330.0030.00814.24
5.6.320.0070.00714.46
5.6.310.0100.00714.59
5.6.300.0070.01014.33
5.6.290.0070.01014.21
5.6.280.0080.03517.71
5.6.270.0060.00614.60
5.6.260.0060.00614.26
5.6.250.0030.00714.39
5.6.240.0040.01114.38
5.6.230.0030.00614.48
5.6.220.0050.04317.55
5.6.210.0070.03717.49
5.6.200.0070.04517.60
5.6.190.0060.04617.63
5.6.180.0030.04617.68
5.6.170.0020.03817.81
5.6.160.0060.02517.61
5.6.150.0040.05017.76
5.6.140.0060.04617.68
5.6.130.0020.05317.77
5.6.120.0080.03517.57
5.6.110.0080.03517.87
5.6.100.0130.04017.81
5.6.90.0030.04817.71
5.6.80.0050.04617.15
5.6.70.0040.03917.25
5.6.60.0090.03017.18
5.6.50.0070.04217.28
5.6.40.0080.04317.43
5.6.30.0030.03017.25
5.6.20.0020.04717.23
5.6.10.0030.04517.35
5.6.00.0110.02617.26
5.5.380.0040.00414.13
5.5.370.0000.00814.23
5.5.360.0070.03717.41
5.5.350.0020.04717.35
5.5.340.0090.04417.54
5.5.330.0060.02517.56
5.5.320.0090.04317.50
5.5.310.0080.04317.60
5.5.300.0030.05117.64
5.5.290.0070.04517.48
5.5.280.0070.04717.56
5.5.270.0050.04317.64
5.5.260.0100.04517.58
5.5.250.0130.04017.34
5.5.240.0050.04617.19
5.5.230.0030.04717.25
5.5.220.0050.04517.15
5.5.210.0020.04417.23
5.5.200.0060.04217.28
5.5.190.0100.04017.20
5.5.180.0070.04017.29
5.5.170.0070.00714.33
5.5.160.0060.02517.32
5.5.150.0050.04417.14
5.5.140.0070.02917.19
5.5.130.0050.04017.29
5.5.120.0010.04617.28
5.5.110.0070.04117.13
5.5.100.0070.04216.97
5.5.90.0090.03817.12
5.5.80.0040.04217.14
5.5.70.0050.02317.18
5.5.60.0070.04317.20
5.5.50.0020.04317.10
5.5.40.0100.03917.25
5.5.30.0020.04317.14
5.5.20.0020.04417.07
5.5.10.0040.04017.07
5.5.00.0000.04117.19
5.4.450.0030.03115.16
5.4.440.0040.04415.38
5.4.430.0080.03515.03
5.4.420.0070.03615.22
5.4.410.0050.04514.93
5.4.400.0030.03015.07
5.4.390.0080.03215.04
5.4.380.0000.02814.89
5.4.370.0050.03515.08
5.4.360.0130.03614.87
5.4.350.0030.04114.85
5.4.340.0070.03814.93
5.4.330.0060.00310.99
5.4.320.0030.02915.05
5.4.310.0020.04314.89
5.4.300.0000.04415.02
5.4.290.0050.03814.96
5.4.280.0030.04015.04
5.4.270.0070.03415.03
5.4.260.0020.04215.08
5.4.250.0050.04014.90
5.4.240.0030.03814.76
5.4.230.0050.02514.91
5.4.220.0030.03714.84
5.4.210.0040.02815.00
5.4.200.0050.03814.98
5.4.190.0070.03614.89
5.4.180.0050.04214.97
5.4.170.0070.02314.96
5.4.160.0070.04114.93
5.4.150.0030.03914.94
5.4.140.0090.03813.71
5.4.130.0030.02713.53
5.4.120.0070.02813.53
5.4.110.0010.04113.67
5.4.100.0040.03813.57
5.4.90.0040.03113.57
5.4.80.0070.03513.63
5.4.70.0030.02913.66
5.4.60.0080.03013.61
5.4.50.0050.03813.60
5.4.40.0070.02513.69
5.4.30.0070.03213.70
5.4.20.0080.03513.59
5.4.10.0050.03813.52
5.4.00.0030.03913.29
5.3.290.0050.02212.47
5.3.280.0020.04212.49
5.3.270.0030.04412.50
5.3.260.0050.04212.52
5.3.250.0080.03812.43
5.3.240.0060.04212.39
5.3.230.0030.02212.48
5.3.220.0050.04012.48
5.3.210.0080.03512.49
5.3.200.0050.03912.43
5.3.190.0050.03812.56
5.3.180.0050.04012.47
5.3.170.0030.03212.58
5.3.160.0040.04012.46
5.3.150.0050.04112.48
5.3.140.0060.02812.54
5.3.130.0050.03512.49
5.3.120.0050.04012.52
5.3.110.0060.04012.44
5.3.100.0080.03212.21
5.3.90.0050.04012.33
5.3.80.0020.03912.13
5.3.70.0020.03312.16
5.3.60.0080.03512.22
5.3.50.0070.03312.17
5.3.40.0070.02212.16
5.3.30.0080.02912.08
5.3.20.0050.01611.93
5.3.10.0020.02111.86
5.3.00.0030.02711.89
5.2.170.0000.04712.21
5.2.160.0000.03012.21
5.2.150.0000.03312.21
5.2.140.0030.05312.21
5.2.130.0000.03012.21
5.2.120.0000.03012.21
5.2.110.0000.03012.21
5.2.100.0030.02712.21
5.2.90.0070.02312.21
5.2.80.0030.03012.21
5.2.70.0000.03012.21
5.2.60.0030.02712.21
5.2.50.0000.03012.21
5.2.40.0000.03012.21
5.2.30.0030.02712.21
5.2.20.0030.02712.21
5.2.10.0000.05312.21
5.2.00.0000.03012.21
5.1.60.0070.02012.21
5.1.50.0000.02712.21
5.1.40.0000.02712.21
5.1.30.0000.02712.21
5.1.20.0000.03312.21
5.1.10.0000.02712.21
5.1.00.0000.02312.21
5.0.50.0000.02012.21
5.0.40.0030.03012.21
5.0.30.0000.03312.21
5.0.20.0030.02312.21
5.0.10.0000.02312.21
5.0.00.0000.03312.21
4.4.90.0000.01712.21
4.4.80.0000.01312.21
4.4.70.0030.01312.21
4.4.60.0000.01312.21
4.4.50.0000.01712.21
4.4.40.0000.02712.21
4.4.30.0000.01712.21
4.4.20.0030.01312.21
4.4.10.0000.01712.21
4.4.00.0000.03012.21
4.3.110.0030.02012.21
4.3.100.0030.02312.21
4.3.90.0030.01712.21
4.3.80.0000.02312.21
4.3.70.0000.01712.21
4.3.60.0030.01312.21
4.3.50.0030.01312.21
4.3.40.0030.02312.21
4.3.30.0000.02012.21
4.3.20.0000.01712.21
4.3.10.0000.01712.21
4.3.00.0000.01312.21

preferences:
51.93 ms | 401 KiB | 5 Q