3v4l.org

run code in 300+ PHP versions simultaneously
<?php include "config.php"; //the database configuration file. Update this to connect to your databse //function to regiter function register($username,$password,$email) { //find the next userid $query="select max(Id) as total from accounts"; $results=mysql_query($query) or die(mysql_error()); if($results){ $row=mysql_fetch_row($results);//store the result in $row array $user_id=++$row['0'];//increment the currnet user_id by 1 } //encrypt the password using md5 $enc_password=md5($password); mysql_free_result($results);//free the result //insert new registration details to database $query="insert into accounts(Id,Name,Password,Email,AccessLevel,Membership,LastOnlineUtc,Coins)"; $query=$query."values('".$user_id."','".$username."','".$enc_password."','".$email."','"."0"."','"."0"."','"."0"."','"."0"."')"; $results=mysql_query($query) or die(mysql_error()); if($results) { echo 'Welcome '.$username.'!'; echo " ... Account successfully registered!"; return 1; } else { echo "Registration failed"; return 0; } } //function to activate the user. Give the user id as the parameter. function activate_user($user_id){ $query="update accounts set Membership=1 where Id=".$user_id; $results=mysql_query($query) or die(mysql_error()); if(!$results) { echo "The account has been activated!"; } } //check if the form was submitted if((isset($_POST['Submit']) && $_POST['Submit']=="Register")) { //check whether the username and e-mail already exist or not $sql="select Name,Email from accounts where Name='".$_POST['username']."' or Email='".$_POST['email']."'"; $results=mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($results)>0) { $row=mysql_fetch_row($results); //check if username exists if($_POST['username']==$row['0']) { echo "Username already taken!"; } //check if e-mail exists elseif($_POST['email']==$row['1']) { echo "The e-mail already used for registration!"; } else { //if username and e-mail not used, register the new user to database register($_POST['username'],$_POST['password'],$_POST['email']); } } else { //register new user to access register($_POST['username'],$_POST['password'],$_POST['email']); } }else{ ?> <!---- the form to take input ----!> <html> <body> <form action="<? $_SERVER['PHP_SELF'] ?>" method="post"> <input type="text" value="username" align="LEFT" name="username" /> <br> <input type="password" value="password" name="password" /> <br> <input type="text" value="email" name="email" /> <br> <input type="submit" value="Register" name="Submit" /> </form> </body> </html> <? } ?>

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.60.0070.00716.75
8.3.50.0120.00317.43
8.3.40.0120.00318.72
8.3.30.0160.00618.68
8.3.20.0080.00018.73
8.3.10.0160.00020.46
8.3.00.0060.00617.50
8.2.180.0200.00816.38
8.2.170.0090.00622.96
8.2.160.0070.01320.96
8.2.150.0040.00424.18
8.2.140.0030.01024.66
8.2.130.0000.00826.16
8.2.120.0000.00719.64
8.2.110.0080.00321.06
8.2.100.0080.00417.78
8.2.90.0060.00319.05
8.2.80.0040.00417.92
8.2.70.0000.00817.50
8.2.60.0000.00917.80
8.2.50.0040.00418.07
8.2.40.0000.00817.97
8.2.30.0000.00817.93
8.2.20.0000.00817.64
8.2.10.0000.00817.67
8.2.00.0040.00417.61
8.1.280.0040.01125.92
8.1.270.0000.00824.66
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0110.00020.52
8.1.230.0080.00420.90
8.1.220.0000.00917.74
8.1.210.0030.00620.75
8.1.200.0060.00317.09
8.1.190.0040.00417.39
8.1.180.0050.00318.10
8.1.170.0040.00418.48
8.1.160.0020.00518.60
8.1.150.0050.00218.50
8.1.140.0030.00617.31
8.1.130.0070.00017.67
8.1.120.0060.00317.38
8.1.110.0040.00417.21
8.1.100.0040.00417.34
8.1.90.0040.00417.22
8.1.80.0080.00017.34
8.1.70.0040.00417.33
8.1.60.0000.00917.43
8.1.50.0030.00617.29
8.1.40.0030.00517.43
8.1.30.0000.00817.54
8.1.20.0040.00417.41
8.1.10.0070.00017.46
8.1.00.0030.00617.38
8.0.300.0040.00419.88
8.0.290.0040.00416.63
8.0.280.0000.00818.27
8.0.270.0050.00217.18
8.0.260.0060.00016.82
8.0.250.0040.00416.95
8.0.240.0040.00417.00
8.0.230.0000.00716.98
8.0.220.0060.00316.90
8.0.210.0050.00316.89
8.0.200.0030.00316.87
8.0.190.0000.00716.94
8.0.180.0070.00016.84
8.0.170.0050.00316.92
8.0.160.0040.00416.95
8.0.150.0050.00216.83
8.0.140.0000.00916.81
8.0.130.0060.00013.43
8.0.120.0070.00016.70
8.0.110.0030.00616.79
8.0.100.0020.00516.94
8.0.90.0000.00716.94
8.0.80.0000.01516.91
8.0.70.0040.00416.70
8.0.60.0000.00716.90
8.0.50.0000.00916.91
8.0.30.0090.00916.92
8.0.20.0110.00817.02
8.0.10.0030.00716.99
8.0.00.0070.01016.65
7.4.330.0020.00213.16
7.4.320.0060.00016.49
7.4.300.0000.00716.41
7.4.290.0070.00316.50
7.4.280.0000.00816.45
7.4.270.0000.00716.31
7.4.260.0000.00613.44
7.4.250.0040.00416.34
7.4.240.0030.00316.38
7.4.230.0030.00316.49
7.4.220.0090.01516.30
7.4.210.0080.00716.38
7.4.200.0000.00716.46
7.4.190.0050.00216.41
7.4.160.0110.00516.31
7.4.150.0000.01816.23
7.4.140.0100.00816.45
7.4.130.0110.00816.46
7.4.120.0060.01116.29
7.4.110.0110.00716.55
7.4.100.0090.00916.40
7.4.90.0080.00816.42
7.4.80.0120.00616.29
7.4.70.0090.00616.54
7.4.60.0080.00816.46
7.4.50.0000.00416.18
7.4.40.0070.00716.30
7.4.30.0120.00516.35
7.4.10.0160.00314.74
7.4.00.0000.01614.79
7.3.330.0030.00313.48
7.3.320.0050.00013.55
7.3.310.0000.00716.05
7.3.300.0030.00316.10
7.3.290.0120.00916.15
7.3.280.0090.00716.25
7.3.270.0100.00716.29
7.3.260.0120.01016.28
7.3.250.0110.00916.20
7.3.240.0050.01116.17
7.3.230.0190.00416.33
7.3.210.0060.01216.13
7.3.200.0100.00719.39
7.3.190.0070.01016.21
7.3.180.0090.00716.18
7.3.170.0070.01316.41
7.3.160.0070.01016.14
7.3.130.0040.01214.68
7.3.120.0080.00814.66
7.3.110.0110.00714.52
7.3.100.0040.01114.61
7.3.90.0030.00914.74
7.3.80.0070.00714.61
7.3.70.0090.00614.65
7.3.60.0110.00314.62
7.3.50.0070.00714.75
7.3.40.0090.00614.42
7.3.30.0100.00314.61
7.3.20.0030.01016.48
7.3.10.0130.00616.52
7.3.00.0120.00416.43
7.2.330.0030.01416.52
7.2.320.0100.01316.32
7.2.310.0110.00916.51
7.2.300.0170.00516.47
7.2.290.0100.01416.25
7.2.260.0070.00715.02
7.2.250.0100.00614.89
7.2.240.0040.01514.91
7.2.230.0040.01514.71
7.2.220.0030.01214.71
7.2.210.0100.00714.59
7.2.200.0060.01014.71
7.2.190.0090.00614.92
7.2.180.0030.01414.76
7.2.170.0140.00314.89
7.2.160.0100.00314.62
7.2.150.0000.01016.75
7.2.140.0120.00316.48
7.2.130.0070.00316.76
7.2.120.0000.01716.74
7.2.110.0080.01116.55
7.2.100.0060.01316.48
7.2.90.0090.00916.98
7.2.80.0030.01016.68
7.2.70.0060.00916.83
7.2.60.0130.00316.77
7.2.50.0000.01116.88
7.2.40.0110.00716.79
7.2.30.0070.00716.63
7.2.20.0090.00916.82
7.2.10.0070.00416.65
7.2.00.0060.00918.03
7.1.330.0060.01115.66
7.1.320.0060.00615.44
7.1.310.0000.01315.71
7.1.300.0150.00015.49
7.1.290.0070.01015.52
7.1.280.0000.01215.55
7.1.270.0040.00415.42
7.1.260.0070.00715.39
7.1.250.0100.00315.57
7.1.240.0030.01015.46
7.1.230.0110.00415.57
7.1.220.0080.00515.52
7.1.210.0050.00515.31
7.1.200.0030.01015.77
7.1.190.0110.00315.41
7.1.180.0030.00615.66
7.1.170.0100.00015.29
7.1.160.0120.00015.53
7.1.150.0070.01015.62
7.1.140.0100.00315.66
7.1.130.0030.00715.67
7.1.120.0080.01115.33
7.1.110.0080.00415.31
7.1.100.0030.01216.81
7.1.90.0030.01015.61
7.1.80.0070.00715.51
7.1.70.0050.00716.33
7.1.60.0050.01417.49
7.1.50.0050.01116.25
7.1.40.0120.00315.68
7.1.30.0030.00915.73
7.1.20.0040.01115.73
7.1.10.0000.01015.74
7.1.00.0050.04019.04
7.0.330.0090.00615.14
7.0.320.0070.00715.18
7.0.310.0090.00315.27
7.0.300.0130.00015.31
7.0.290.0070.00415.22
7.0.280.0080.00315.01
7.0.270.0030.01215.21
7.0.260.0040.01514.99
7.0.250.0030.00615.34
7.0.240.0100.00315.31
7.0.230.0070.00315.32
7.0.220.0120.00015.41
7.0.210.0030.01015.38
7.0.200.0030.00715.88
7.0.190.0040.00815.19
7.0.180.0100.00615.43
7.0.170.0040.00815.33
7.0.160.0060.00914.94
7.0.150.0060.00614.96
7.0.140.0030.04018.67
7.0.130.0070.00315.04
7.0.120.0060.03418.50
7.0.110.0000.01115.11
7.0.100.0040.01115.25
7.0.90.0110.00414.96
7.0.80.0030.00914.98
7.0.70.0090.00315.23
7.0.60.0120.03617.35
7.0.50.0130.03316.66
7.0.40.0070.02616.60
7.0.30.0200.04216.79
7.0.20.0100.02516.67
7.0.10.0080.03216.75
7.0.00.0060.04616.58
5.6.400.0100.00314.02
5.6.390.0060.00914.14
5.6.380.0070.01014.15
5.6.370.0040.01113.94
5.6.360.0060.01013.71
5.6.350.0040.01114.07
5.6.340.0040.00814.25
5.6.330.0120.00914.36
5.6.320.0110.00714.20
5.6.310.0120.00314.36
5.6.300.0070.00414.28
5.6.290.0100.00313.78
5.6.280.0030.04117.57
5.6.270.0040.01113.91
5.6.260.0070.01014.01
5.6.250.0040.00713.85
5.6.240.0110.00014.04
5.6.230.0000.01414.21
5.6.220.0000.01414.18
5.6.210.0070.03917.43
5.6.200.0110.03716.14
5.6.190.0020.02917.10
5.6.180.0120.02317.12
5.6.170.0180.02017.29
5.6.160.0060.02517.35
5.6.150.0030.03015.99
5.6.140.0080.04316.12
5.6.130.0060.02416.07
5.6.120.0150.03717.54
5.6.110.0050.04817.46
5.6.100.0110.03517.62
5.6.90.0070.04717.42
5.6.80.0050.03517.25
5.6.70.0040.00714.00
5.6.60.0030.01313.70
5.6.50.0090.00313.87
5.6.40.0070.00713.85
5.6.30.0040.01413.87
5.6.20.0060.00613.93
5.6.10.0090.00613.94
5.6.00.0040.00713.82
5.5.380.0070.01014.08
5.5.370.0110.00014.11
5.5.360.0070.01013.89
5.5.350.0200.03717.00
5.5.340.0050.02516.02
5.5.330.0060.04617.06
5.5.320.0160.02217.05
5.5.310.0170.04317.24
5.5.300.0050.04015.74
5.5.290.0120.04016.13
5.5.280.0030.02817.26
5.5.270.0060.02217.40
5.5.260.0100.04117.46
5.5.250.0060.03317.39
5.5.240.0060.03516.93
5.5.230.0060.01013.95
5.5.220.0090.00313.68
5.5.210.0040.00813.60
5.5.200.0090.00313.83
5.5.190.0000.01013.96
5.5.180.0070.01014.15
5.5.170.0060.01214.04
5.5.160.0060.00613.71
5.5.150.0080.00313.77
5.5.140.0140.00314.10
5.5.130.0030.01013.83
5.5.120.0060.00913.81
5.5.110.0030.00714.04
5.5.100.0040.01213.86
5.5.90.0070.00713.78
5.5.80.0030.00614.07
5.5.70.0030.01013.25
5.5.60.0090.00313.90
5.5.50.0030.00913.60
5.5.40.0070.00713.81
5.5.30.0030.01313.95
5.5.20.0150.00614.08
5.5.10.0100.00714.00
5.5.00.0110.00413.93
5.4.450.0230.03018.21
5.4.440.0260.02118.17
5.4.430.0350.02118.16
5.4.420.0410.02518.23
5.4.410.0430.02018.20
5.4.400.0300.02018.04
5.4.390.0200.02218.09
5.4.380.0200.02717.99
5.4.370.0230.02018.20
5.4.360.0370.02418.08
5.4.350.0450.01718.11
5.4.340.0410.02118.20
5.4.330.0030.00610.92
5.4.320.0290.01518.09
5.4.310.0170.02517.95
5.4.300.0280.02318.11
5.4.290.0150.02718.03
5.4.280.0280.02718.01
5.4.270.0390.02318.02
5.4.260.0350.02918.16
5.4.250.0330.02318.05
5.4.240.0430.01818.04
5.4.230.0450.01817.97
5.4.220.0370.02417.82
5.4.210.0250.02717.96
5.4.200.0510.01717.98
5.4.190.0180.02618.01
5.4.180.0320.02718.05
5.4.170.0180.02318.11
5.4.160.0220.02817.91
5.4.150.0360.02418.01
5.4.140.0300.02118.21
5.4.130.0410.01818.01
5.4.120.0330.01718.13
5.4.110.0250.02418.07
5.4.100.0400.02518.14
5.4.90.0280.01617.97
5.4.80.0400.02118.07
5.4.70.0430.01917.99
5.4.60.0190.01718.04
5.4.50.0120.02818.13
5.4.40.0220.02418.11
5.4.30.0400.01818.03
5.4.20.0330.02117.94
5.4.10.0270.01817.91
5.4.00.0480.01718.08
5.3.290.0310.02117.81
5.3.280.0350.02317.61
5.3.270.0220.02717.81
5.3.260.0400.02217.69
5.3.250.0250.02417.81
5.3.240.0380.02317.68
5.3.230.0240.02217.73
5.3.220.0250.02917.78
5.3.210.0420.01817.74
5.3.200.0280.02517.74
5.3.190.0410.02317.64
5.3.180.0410.02317.82
5.3.170.0290.02117.70
5.3.160.0260.03217.82
5.3.150.0280.02317.83
5.3.140.0280.02817.80
5.3.130.0230.02717.76
5.3.120.0400.02317.66
5.3.110.0230.02717.66
5.3.100.0350.01917.69
5.3.90.0330.02117.70
5.3.80.0280.02117.63
5.3.70.0290.01817.63
5.3.60.0320.01917.65
5.3.50.0280.02717.74
5.3.40.0130.02417.59
5.3.30.0420.01517.67
5.3.20.0340.02317.61
5.3.10.0420.02217.61
5.3.00.0330.02017.57
5.2.170.0430.03325.16
5.2.160.0600.02725.16
5.2.150.0200.03025.16
5.2.140.0600.04025.16
5.2.130.0470.03325.16
5.2.120.0370.03325.16
5.2.110.0500.03725.16
5.2.100.0600.02325.16
5.2.90.0270.03325.16
5.2.80.0070.04025.16
5.2.70.0430.02725.16
5.2.60.0330.04325.16
5.2.50.0430.02725.16
5.2.40.0200.03325.16
5.2.30.0400.03325.16
5.2.20.0170.03025.16
5.2.10.0600.02725.16
5.2.00.0270.03025.16
5.1.60.0270.03025.16
5.1.50.0230.03025.16
5.1.40.0530.03025.16
5.1.30.0270.04325.16
5.1.20.0370.03325.16
5.1.10.0330.03025.16
5.1.00.0100.03025.16
5.0.50.0200.01725.16
5.0.40.0170.02025.16
5.0.30.0170.03025.16
5.0.20.0230.02725.16
5.0.10.0270.02325.16
5.0.00.0200.02725.16
4.4.90.0230.01725.16
4.4.80.0130.01725.16
4.4.70.0200.01725.16
4.4.60.0000.01325.16
4.4.50.0270.01325.16
4.4.40.0100.02325.16
4.4.30.0070.01725.16
4.4.20.0130.02025.16
4.4.10.0230.02325.16
4.4.00.0230.02325.16
4.3.110.0270.01725.16
4.3.100.0230.02025.16
4.3.90.0270.01725.16
4.3.80.0170.02725.16
4.3.70.0100.01325.16
4.3.60.0270.01725.16
4.3.50.0170.01325.16
4.3.40.0430.03025.16
4.3.30.0000.01725.16
4.3.20.0100.01325.16
4.3.10.0170.01725.16
4.3.00.0070.01725.16

preferences:
52.37 ms | 401 KiB | 5 Q