3v4l.org

run code in 300+ PHP versions simultaneously
<?php // データ定義 $data = array( array( '入力項目1', 'チェックボックス1', '選択1', 'あいうえお', ), array( '入力項目2', 'チェックボックス2', '選択2', 'アイウエオ', ), ); // 例外処理ブロック try { // DB接続 if (!($link = @mysql_connect('localhost', 'ABCD', 'EFGH'))) { throw new RuntimeException('DB接続に失敗しました。'); } // 文字セット指定 mysql_set_charset('utf8', $link); // DB選択 if (!@mysql_select_db('test_db', $link)) { throw new RuntimeException('DB選択に失敗しました。'); } // SQL文フォーマット $format = 'INSERT ' . 'INTO `product_b` (`text`, `checkbox`, `setntaku`, `textarea`) ' . 'VALUES (%s, %s, %s, %s)' ; foreach ($data as $d) { // 値をエスケープ $d = array_map( function ($i) use ($link) { return mysql_real_escape_string($i, $link); }, $d ); // 値をバインドしてSQL実行 if (!mysql_query(vprintf($format, $d), $link)) { throw new RuntimeException('データ挿入に失敗しました。'); } } // 正常時 $message = 'エラーはありません。'; } catch (RuntimeException $e) { // 例外が発生したとき $message = htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8'); } // ブラウザにcharsetを伝える header('Content-Type: text/html; charset=utf-8'); ?> <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <p><?=$message?></p> </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.00416.50
8.3.50.0040.01421.89
8.3.40.0090.00618.84
8.3.30.0070.00719.13
8.3.20.0040.00420.35
8.3.10.0080.00023.66
8.3.00.0000.00819.51
8.2.180.0130.00716.75
8.2.170.0110.00422.96
8.2.160.0070.00720.38
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00022.26
8.2.110.0070.00322.26
8.2.100.0080.00417.66
8.2.90.0060.00319.21
8.2.80.0080.00017.97
8.2.70.0060.00517.36
8.2.60.0040.00417.77
8.2.50.0070.00218.07
8.2.40.0000.00819.66
8.2.30.0040.00418.18
8.2.20.0000.00717.79
8.2.10.0060.00318.07
8.2.00.0070.00017.75
8.1.280.0140.00725.92
8.1.270.0030.00523.96
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0090.00023.88
8.1.230.0060.00618.97
8.1.220.0080.00017.80
8.1.210.0030.00518.77
8.1.200.0000.00817.35
8.1.190.0050.00317.25
8.1.180.0060.00319.01
8.1.170.0040.00418.54
8.1.160.0020.00522.08
8.1.150.0030.00618.58
8.1.140.0040.00417.49
8.1.130.0070.00017.73
8.1.120.0000.00717.48
8.1.110.0040.00417.53
8.1.100.0000.00817.47
8.1.90.0040.00417.37
8.1.80.0050.00217.44
8.1.70.0000.00917.46
8.1.60.0090.00317.62
8.1.50.0000.00817.42
8.1.40.0000.00717.43
8.1.30.0040.00417.57
8.1.20.0040.00417.64
8.1.10.0030.00617.49
8.1.00.0040.00417.42
8.0.300.0000.00919.15
8.0.290.0070.00017.28
8.0.280.0040.00418.54
8.0.270.0030.00317.20
8.0.260.0030.00317.16
8.0.250.0000.00717.09
8.0.240.0030.00316.92
8.0.230.0000.00716.94
8.0.220.0000.00717.00
8.0.210.0070.00016.89
8.0.200.0040.00417.04
8.0.190.0040.00416.94
8.0.180.0040.00417.02
8.0.170.0040.00417.00
8.0.160.0040.00416.86
8.0.150.0030.00616.99
8.0.140.0070.00016.83
8.0.130.0030.00313.38
8.0.120.0040.00416.98
8.0.110.0000.00716.97
8.0.100.0030.00517.07
8.0.90.0070.00016.96
8.0.80.0090.00916.98
8.0.70.0040.00417.03
8.0.60.0040.00416.92
8.0.50.0050.00217.00
8.0.30.0080.01017.10
8.0.20.0060.01417.40
8.0.10.0000.00817.20
8.0.00.0090.00916.83
7.4.330.0020.00215.05
7.4.320.0030.00316.63
7.4.300.0000.00716.44
7.4.290.0040.00416.65
7.4.280.0070.00016.52
7.4.270.0000.00716.46
7.4.260.0000.00716.61
7.4.250.0040.00416.51
7.4.240.0020.00516.59
7.4.230.0030.00316.73
7.4.220.0070.02016.49
7.4.210.0090.00916.57
7.4.200.0030.00316.64
7.4.190.0030.00316.39
7.4.160.0110.00716.57
7.4.150.0030.01417.40
7.4.140.0120.00517.86
7.4.130.0090.01016.61
7.4.120.0120.00816.58
7.4.110.0090.00916.59
7.4.100.0140.00716.50
7.4.90.0070.01116.55
7.4.80.0030.01619.39
7.4.70.0090.00916.42
7.4.60.0030.01316.50
7.4.50.0020.00216.42
7.4.40.0030.01316.74
7.4.30.0120.00816.50
7.4.00.0000.01315.03
7.3.330.0000.00713.11
7.3.320.0050.00013.13
7.3.310.0040.00416.39
7.3.300.0040.00416.19
7.3.290.0100.00316.32
7.3.280.0080.00916.38
7.3.270.0180.00017.40
7.3.260.0090.00916.38
7.3.250.0120.01116.43
7.3.240.0120.00916.51
7.3.230.0100.01316.59
7.3.210.0130.00416.48
7.3.200.0100.01019.39
7.3.190.0080.01416.47
7.3.180.0120.00916.55
7.3.170.0030.01316.57
7.3.160.0080.00916.46
7.3.120.0100.00714.98
7.2.330.0170.00016.47
7.2.320.0110.00716.74
7.2.310.0040.01616.61
7.2.300.0150.00316.36
7.2.290.0150.00916.43
7.2.60.0030.01316.50
7.2.00.0000.01319.38
7.1.200.0060.00915.73
7.1.100.0040.00718.17
7.1.70.0030.01317.16
7.1.60.0090.01519.46
7.1.50.0260.00634.76
7.1.00.0100.07022.28
7.0.200.0090.00316.73
7.0.140.0030.07721.95
7.0.70.0030.06021.73
7.0.60.0030.07321.71
7.0.50.0100.03722.12
7.0.40.0000.08020.18
7.0.30.0030.08320.09
7.0.20.0070.09320.04
7.0.10.0030.07720.14
7.0.00.0030.04720.09
5.6.280.0030.07321.08
5.6.220.0170.07320.63
5.6.210.0000.09020.62
5.6.200.0000.04720.97
5.6.190.0100.07721.02
5.6.180.0030.08721.18
5.6.170.0000.09021.05
5.6.160.0070.06720.95
5.6.150.0030.05720.98
5.6.140.0030.08320.99
5.6.130.0030.04721.02
5.6.120.0070.04321.02
5.6.110.0030.07721.18
5.6.100.0030.08721.08
5.6.90.0100.08021.00
5.6.80.0130.04020.47
5.6.70.0030.04720.56
5.6.60.0030.04020.45
5.6.50.0000.06320.33
5.6.40.0070.08020.39
5.6.30.0100.04320.39
5.6.20.0200.06020.40
5.6.10.0130.06720.30
5.6.00.0030.08020.44
5.5.360.0030.07320.42
5.5.350.0070.07720.41
5.5.340.0070.08320.82
5.5.330.0030.06720.93
5.5.320.0000.09020.93
5.5.310.0030.06020.79
5.5.300.0030.08020.84
5.5.290.0030.04020.94
5.5.280.0030.08720.90
5.5.270.0070.08020.90
5.5.260.0100.07720.89
5.5.250.0030.05320.73
5.5.240.0000.04320.26
5.5.230.0030.07020.19
5.5.220.0070.07320.21
5.5.210.0030.06320.27
5.5.200.0030.08320.25
5.5.190.0000.04320.25
5.5.180.0030.04320.29
5.5.160.0070.08020.20
5.5.150.0070.05720.27
5.5.140.0070.05020.25
5.5.130.0030.07020.09
5.5.120.0000.08320.26
5.5.110.0000.06720.21
5.5.100.0030.08320.12
5.5.90.0030.08720.08
5.5.80.0000.08020.13
5.5.70.0030.05719.95
5.5.60.0030.05320.17
5.5.50.0070.04320.07
5.5.40.0030.07720.10
5.5.30.0070.07320.10
5.5.20.0070.06320.13
5.5.10.0130.07320.02
5.5.00.0000.08320.01
5.4.450.0000.04319.49
5.4.440.0030.07319.41
5.4.430.0130.03319.35
5.4.420.0030.07319.46
5.4.410.0100.07319.04
5.4.400.0000.05719.13
5.4.390.0070.07019.21
5.4.380.0030.05719.23
5.4.370.0030.04719.21
5.4.360.0070.08019.16
5.4.350.0030.08319.13
5.4.340.0000.04019.23
5.4.320.0130.07318.88
5.4.310.0030.07719.12
5.4.300.0000.05018.84
5.4.290.0000.08019.04
5.4.280.0100.07719.04
5.4.270.0030.08018.90
5.4.260.0070.07719.02
5.4.250.0030.06319.02
5.4.240.0070.07019.12
5.4.230.0070.04319.12
5.4.220.0070.07319.18
5.4.210.0030.05319.18
5.4.200.0000.07719.16
5.4.190.0030.07318.89
5.4.180.0030.05319.22
5.4.170.0070.05319.15
5.4.160.0030.07019.21
5.4.150.0030.08019.02
5.4.140.0030.04016.42
5.4.130.0070.05016.39
5.4.120.0070.07316.32
5.4.110.0100.07016.43
5.4.100.0030.03316.49
5.4.90.0030.03316.50
5.4.80.0030.05716.26
5.4.70.0030.03716.28
5.4.60.0000.06316.33
5.4.50.0030.05316.33
5.4.40.0000.04716.49
5.4.30.0030.04016.44
5.4.20.0030.05716.31
5.4.10.0030.06316.29
5.4.00.0030.07015.86
5.3.290.0000.08014.77
5.3.280.0000.07314.62
5.3.270.0030.08714.67
5.3.260.0000.08314.58
5.3.250.0070.06714.68
5.3.240.0100.06714.66
5.3.230.0070.06014.63
5.3.220.0000.08014.69
5.3.210.0030.07714.50
5.3.200.0000.04714.70
5.3.190.0030.05014.58
5.3.180.0030.06014.64
5.3.170.0000.07314.56
5.3.160.0030.08014.60
5.3.150.0070.07714.64
5.3.140.0000.05714.68
5.3.130.0070.07314.57
5.3.120.0070.07714.50
5.3.110.0000.08314.63
5.3.100.0100.04313.98
5.3.90.0030.04014.18
5.3.80.0000.07713.92
5.3.70.0030.07014.02
5.3.60.0070.06714.11
5.3.50.0000.05013.98
5.3.40.0000.08013.99
5.3.30.0030.05314.02
5.3.20.0000.07313.70
5.3.10.0000.06313.77
5.3.00.0070.03713.79
5.2.170.0030.04712.19
5.2.160.0030.03712.19
5.2.150.0030.05312.19
5.2.140.0070.03012.19
5.2.130.0030.03312.19
5.2.120.0030.06012.19
5.2.110.0070.03012.19
5.2.100.0000.05012.19
5.2.90.0000.06312.19
5.2.80.0030.05712.19
5.2.70.0000.06012.19
5.2.60.0000.06012.19
5.2.50.0000.06312.19
5.2.40.0070.06312.19
5.2.30.0000.03712.19
5.2.20.0030.06012.19
5.2.10.0030.06312.19
5.2.00.0030.03712.19
5.1.60.0000.03712.19
5.1.50.0000.05712.19
5.1.40.0000.04312.19
5.1.30.0000.03012.19
5.1.20.0000.04012.19
5.1.10.0000.02712.19
5.1.00.0000.03712.19
5.0.50.0030.03712.19
5.0.40.0000.02712.19
5.0.30.0030.05312.19
5.0.20.0030.04312.19
5.0.10.0030.04312.19
5.0.00.0030.06312.19
4.4.90.0030.03712.19
4.4.80.0030.02712.19
4.4.70.0000.03712.19
4.4.60.0000.03712.19
4.4.50.0000.03712.19
4.4.40.0000.05312.19
4.4.30.0000.03012.19
4.4.20.0000.02012.19
4.4.10.0030.02312.19
4.4.00.0000.04012.19
4.3.110.0000.02712.19
4.3.100.0030.02712.19
4.3.90.0030.03012.19
4.3.80.0000.05312.19
4.3.70.0000.03712.19
4.3.60.0070.02712.19
4.3.50.0030.03312.19
4.3.40.0030.05012.19
4.3.30.0000.03312.19
4.3.20.0000.03012.19
4.3.10.0030.02012.19
4.3.00.0030.01312.19

preferences:
41.68 ms | 401 KiB | 5 Q