3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); $error_message = ""; // ログインボタンが押されたかを判定 // 初めてのアクセスでは認証は行わずエラーメッセージは表示しない if (isset($_POST["login"])) { // ID・パスの入力チェック if (trim($_POST["user_id"]) == ''){ $error_message = "ID・パスワードを入力してください"; exit(); } elseif (trim($_POST["password"]) == ''){ $error_message = "ID・パスワードを入力してください" ; exit(); } elseif (!ctype_digit($_POST["user_id"]) == false) { $error_message = "IDは半角数字で入力してください"; exit(); } elseif (!ctype_digit($_POST["password"]) == false) { $error_message = "パスワードは半角英数字で入力してください"; exit(); } // DB $url = "localhost"; $user = "root"; $pass = ""; $db = "test"; // MySQLへ接続する $link = mysql_connect($url,$user,$pass) or die("MySQLへの接続に失敗しました。"); // データベースを選択する $sdb = mysql_select_db($db,$link) or die("データベースの選択に失敗しました。"); // クエリを送信する ID・パス照会 $sql = "select * from user "; $sql.= "where user_id= " . $_REQUEST["user_id"] ; $result = mysql_query($sql, $link) or die("クエリの送信に失敗しました。 <br/>SQL:".$sql); $row = mysql_fetch_assoc($result); // ①パスワードが一致する場合、ログイン if ($row["password"] == $_REQUEST["password"]){ // ログインが成功した証をセッションに保存 $_SESSION["user_id"] = $_REQUEST["user_id"]; $_SESSION["name"] = $row["name"]; $_SESSION["user_class"] = $row["class"]; // トップ画面へリダイレクト $login_url = "top.php"; header("Location: {$login_url}"); } // ②一致しない場合、エラーメッセージを格納 else{ $error_message = "ID・パスワードをお確かめください。"; } // MySQLへの接続を閉じる mysql_close($link) or die("MySQL切断に失敗しました。"); // ボタン判定終わり } ?> <html> <head> <title>ログイン画面</title> </head> <body> <center> <br> <br> <font size="2" >日程調整ツール「作成さん」</font><br> <br> <font size="5" >ログイン</font><br> <br> <br> <?php if ($error_message) { print '<font color="red">'.$error_message.'</font>'; } ?> <!-- できたらフォーム位置調整 --> <form action="login.php" method="POST">      ID:<input type="text" name="user_id" value="" /><br /> パスワード:<input type="password" name="password" value"" /><br /> <input type="submit" name="login" value="送信" /> </form> </center> </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.0110.00718.30
8.3.50.0110.00721.21
8.3.40.0030.01018.97
8.3.30.0100.00319.04
8.3.20.0070.00020.39
8.3.10.0000.00822.04
8.3.00.0050.00322.43
8.2.180.0150.00416.75
8.2.170.0080.00822.96
8.2.160.0100.00319.33
8.2.150.0040.00424.18
8.2.140.0090.00624.66
8.2.130.0000.00826.16
8.2.120.0050.00219.66
8.2.110.0030.00620.33
8.2.100.0000.01218.03
8.2.90.0040.00417.88
8.2.80.0000.01017.97
8.2.70.0050.00317.93
8.2.60.0000.00918.28
8.2.50.0040.00418.10
8.2.40.0030.00519.55
8.2.30.0000.00719.26
8.2.20.0030.00517.70
8.2.10.0080.00017.69
8.2.00.0000.00717.68
8.1.280.0070.00725.92
8.1.270.0040.00422.22
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00622.39
8.1.230.0090.00322.78
8.1.220.0000.00817.91
8.1.210.0030.00618.77
8.1.200.0040.00417.48
8.1.190.0060.00317.48
8.1.180.0000.00819.14
8.1.170.0050.00318.84
8.1.160.0000.00819.12
8.1.150.0020.00518.76
8.1.140.0040.00417.49
8.1.130.0070.00017.96
8.1.120.0030.00317.54
8.1.110.0040.00417.47
8.1.100.0070.00017.52
8.1.90.0000.00817.52
8.1.80.0050.00217.42
8.1.70.0000.00817.51
8.1.60.0040.00417.61
8.1.50.0040.00417.47
8.1.40.0070.00017.57
8.1.30.0040.00417.65
8.1.20.0030.00617.71
8.1.10.0080.00017.68
8.1.00.0080.00017.43
8.0.300.0040.00420.11
8.0.290.0050.00316.88
8.0.280.0030.00318.47
8.0.270.0080.00017.39
8.0.260.0040.00416.84
8.0.250.0070.00016.90
8.0.240.0040.00417.03
8.0.230.0080.00016.93
8.0.220.0030.00517.00
8.0.210.0000.00716.85
8.0.200.0050.00317.00
8.0.190.0040.00417.10
8.0.180.0070.00016.93
8.0.170.0050.00217.03
8.0.160.0070.00016.90
8.0.150.0040.00416.96
8.0.140.0050.00216.97
8.0.130.0060.00013.36
8.0.120.0030.00516.96
8.0.110.0000.00716.89
8.0.100.0040.00416.98
8.0.90.0050.00216.91
8.0.80.0060.01016.91
8.0.70.0040.00416.83
8.0.60.0040.00416.96
8.0.50.0050.00217.02
8.0.30.0120.00717.08
8.0.20.0070.01317.40
8.0.10.0040.00416.86
8.0.00.0140.01016.79
7.4.330.0030.00315.16
7.4.320.0000.00716.63
7.4.300.0060.00016.55
7.4.290.0040.00416.69
7.4.280.0070.00016.67
7.4.270.0050.00316.66
7.4.260.0000.00716.57
7.4.250.0000.00816.54
7.4.240.0020.00516.52
7.4.230.0000.00716.67
7.4.220.0030.01716.48
7.4.210.0050.01016.67
7.4.200.0030.00316.77
7.4.190.0000.00816.47
7.4.160.0130.00416.56
7.4.150.0100.00717.40
7.4.140.0110.01017.86
7.4.130.0120.00816.55
7.4.120.0130.00816.56
7.4.110.0150.00716.61
7.4.100.0090.00916.45
7.4.90.0060.01116.67
7.4.80.0070.01019.39
7.4.70.0090.00816.51
7.4.60.0110.00616.68
7.4.50.0060.00316.30
7.4.40.0090.00622.77
7.4.30.0110.00716.67
7.4.00.0090.00614.60
7.3.330.0050.00013.13
7.3.320.0000.00613.21
7.3.310.0000.00716.31
7.3.300.0030.00316.31
7.3.290.0060.01016.29
7.3.280.0060.01016.24
7.3.270.0070.01517.40
7.3.260.0160.00316.26
7.3.250.0080.00916.41
7.3.240.0090.00916.66
7.3.230.0070.01016.44
7.3.210.0070.01016.32
7.3.200.0170.00519.39
7.3.190.0110.00716.21
7.3.180.0120.00916.30
7.3.170.0030.01316.37
7.3.160.0140.00716.33
7.3.120.0070.01014.84
7.2.330.0030.01616.52
7.2.320.0060.01216.47
7.2.310.0120.01216.70
7.2.300.0100.00716.68
7.2.290.0030.01416.68
7.2.00.0040.00819.28
7.1.200.0030.00715.83
7.1.100.0040.01117.98
7.1.70.0000.00717.12
7.1.60.0100.01319.82
7.1.50.0040.01816.90
7.1.00.0030.07722.44
7.0.200.0050.00316.83
7.0.140.0070.07022.07
7.0.70.4330.03719.94
7.0.60.0070.08720.10
7.0.50.0030.07317.82
7.0.40.0070.05020.28
7.0.30.0200.07020.20
7.0.20.0270.07020.04
7.0.10.0230.04320.00
7.0.00.0270.03720.00
5.6.280.0070.07020.97
5.6.210.0100.07320.46
5.6.200.0030.05018.21
5.6.190.0070.04020.49
5.6.180.0200.03720.30
5.6.170.0200.05320.53
5.6.160.0070.08320.51
5.6.150.0100.03318.09
5.6.140.0030.04018.18
5.6.130.0100.08318.22
5.6.120.0070.08721.00
5.6.110.0300.06321.16
5.6.100.0100.07321.00
5.6.90.0030.09321.04
5.6.80.0000.07320.48
5.6.70.0270.07320.43
5.5.350.0100.06020.36
5.5.340.0130.07017.94
5.5.330.0100.05320.25
5.5.320.0000.08720.13
5.5.310.0130.04720.13
5.5.300.0070.06717.98
5.5.290.0070.08017.98
5.5.280.0070.08320.75
5.5.270.0030.07720.82
5.5.260.0100.08320.69
5.5.250.0170.03720.71
5.5.240.0130.07320.24
5.4.450.0800.06019.14
5.4.440.0930.05319.50
5.4.430.0900.07319.11
5.4.420.0830.05319.55
5.4.410.0800.04719.48
5.4.400.0500.05719.13
5.4.390.0530.06318.99
5.4.380.0300.04318.52
5.4.370.0030.04318.54
5.4.360.0300.02318.54
5.4.350.0080.03212.01
5.4.340.0040.03712.00
5.4.320.0060.03612.48
5.4.310.0070.04412.48
5.4.300.0070.03912.48
5.4.290.0060.03812.48
5.4.280.0120.03712.37
5.4.270.0120.04012.35
5.4.260.0070.04512.36
5.4.250.0050.03812.36
5.4.240.0050.03612.36
5.4.230.0080.03712.35
5.4.220.0020.04212.34
5.4.210.0090.03112.35
5.4.200.0070.03712.34
5.4.190.0120.04512.34
5.4.180.0050.03912.34
5.4.170.0060.03712.36
5.4.160.0040.03712.35
5.4.150.0060.03612.35
5.4.140.0070.03612.03
5.4.130.0090.03312.02
5.4.120.0030.04011.98
5.4.110.0040.05411.97
5.4.100.0050.04111.97
5.4.90.0080.03511.97
5.4.80.0060.03911.96
5.4.70.0070.04011.96
5.4.60.0170.05311.96
5.4.50.0100.05311.96
5.4.40.0080.04911.95
5.4.30.0100.06111.95
5.4.20.0060.05211.95
5.4.10.0080.04611.95
5.4.00.0050.04911.44
5.3.290.0050.04012.80
5.3.280.0110.04312.71
5.3.270.0110.04912.72
5.3.260.0090.04212.71
5.3.250.0190.06912.71
5.3.240.0070.05312.72
5.3.230.0110.05012.71
5.3.220.0160.04412.68
5.3.210.0080.04212.68
5.3.200.0060.04012.68
5.3.190.0090.04212.68
5.3.180.0070.04912.68
5.3.170.0060.05512.67
5.3.160.0080.04612.68
5.3.150.0050.04012.67
5.3.140.0110.03412.66
5.3.130.0090.05712.66
5.3.120.0070.05612.65
5.3.110.0050.05412.65
5.3.100.0060.03612.12
5.3.90.0100.04012.08
5.3.80.0030.04112.07
5.3.70.0030.03912.07
5.3.60.0080.03512.06
5.3.50.0070.03512.00
5.3.40.0050.03812.00
5.3.30.0070.03511.96
5.3.20.0070.04011.73
5.3.10.0090.04711.70
5.3.00.0060.04211.70
5.2.170.0070.0409.19
5.2.160.0090.0409.19
5.2.150.0120.0849.19
5.2.140.0110.0689.19
5.2.130.0040.0449.14
5.2.120.0040.0439.15
5.2.110.0070.0479.16
5.2.100.0050.0369.15
5.2.90.0060.0509.15
5.2.80.0050.0509.14
5.2.70.0080.0409.14
5.2.60.0090.0639.10
5.2.50.0070.0479.07
5.2.40.0080.0549.04
5.2.30.0120.0589.02
5.2.20.0080.0419.01
5.2.10.0090.0598.96
5.2.00.0220.0708.82
5.1.60.0080.0378.11
5.1.50.0110.0388.11
5.1.40.0140.0428.08
5.1.30.0090.0448.43
5.1.20.0090.0628.45
5.1.10.0020.0448.18
5.1.00.0110.0558.18
5.0.50.0040.0246.66
5.0.40.0040.0216.52
5.0.30.0050.0326.35
5.0.20.0050.0206.30
5.0.10.0030.0256.29
5.0.00.0120.0496.27
4.4.90.0030.0214.78
4.4.80.0020.0184.75
4.4.70.0050.0184.76
4.4.60.0030.0204.76
4.4.50.0060.0134.77
4.4.40.0000.0304.71
4.4.30.0020.0194.76
4.4.20.0020.0184.85
4.4.10.0020.0184.85
4.4.00.0030.0254.76
4.3.110.0040.0144.67
4.3.100.0010.0174.66
4.3.90.0040.0134.63
4.3.80.0030.0244.58
4.3.70.0020.0154.63
4.3.60.0020.0154.63
4.3.50.0010.0184.63
4.3.40.0030.0254.54
4.3.30.0020.0163.33
4.3.20.0000.0193.32
4.3.10.0030.0163.28
4.3.00.0130.0177.27

preferences:
40.15 ms | 401 KiB | 5 Q