3v4l.org

run code in 300+ PHP versions simultaneously
<?php // よくある変数宣言と代入の例 $a = 17; // グローバルスコープに現在定義されているすべての変数への参照を含む連想配列である $GLOBALS から $a を見る // @see https://www.php.net/manual/ja/reserved.variables.globals.php echo '$a: '.$GLOBALS['a']."\n"; // $a: 17 // $0 を作る例 // $0 = 31; // ←は文法エラーとなります。 // 次リンクには" 有効な変数名は文字またはアンダースコアから始まり、任意の数の文字、 数字、アンダースコアが続きます"とあります。 // https://www.php.net/manual/ja/language.variables.basics.php // $0 がグローバルスコープにないことを確認 var_dump(isset($GLOBALS[0])); // bool(false) // 可変変数で変数名として 0 を使います $varName = 0; $$varName = 31; // $0 がグローバルスコープに増えたことを確認 var_dump(isset($GLOBALS[0])); // bool(true) echo '$0: '.$GLOBALS[0]."\n"; // $0: 31 // グローバルスコープ参照 echo '$0: '.$$varName."\n"; // $0: 31 // 可変変数参照 echo "$0: ${$varName}\n"; // $0: 31 // 可変変数的文字列中の変数のパース https://www.php.net/manual/ja/language.types.string.php#language.types.string.parsing echo "$0: ${0}\n"; // $0: 31 // 直打ち的文字列中の変数のパース https://www.php.net/manual/ja/language.types.string.php#language.types.string.parsing // また、上の $0 同様にこれを利用して定義済み変数の $GLOBALS とは別のグローバルスコープ下にある $GLOBALS を作れます。 // $GLOBALS が通常のグローバルスコープ下にないことを確認 var_dump(isset($GLOBALS['GLOBALS'])); // bool(false) $varName = 'GLOBALS'; $$varName = 47; // $GLOBALS が通常のグローバルスコープ下に増えたことを確認 var_dump(isset($GLOBALS['GLOBALS'])); // bool(true) echo '$GLOBALS: '.$GLOBALS['GLOBALS']."\n"; // $GLOBALS: 47 // 通常のグローバルスコープ参照 echo '$GLOBALS: '.$$varName."\n"; // $GLOBALS: 47 // 可変変数参照 // 文字列宙の変数のパースでは可変変数的に呼び出すか定義済み名そのもので呼び出すかで挙動が変わります。 // 可変変数的に文字列中の変数のパース echo "\$GLOBALS: ${$varName}\n"; // $GLOBALS: 47 // 定義済み名そのもので文字列中の変数のパース echo "\$GLOBALS: ${'GLOBALS'}\n"; // Warning: Array to string conversion in xxx // $GLOBALS: Array

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.4.20.0100.01017.95
8.4.10.0060.00922.13
8.3.150.0000.01017.12
8.3.140.0040.00417.12
8.3.130.0040.00418.64
8.3.120.0100.01018.92
8.3.110.0090.00020.94
8.3.100.0060.00324.06
8.3.90.0040.00426.77
8.3.80.0090.00017.97
8.3.70.0090.01218.68
8.3.60.0110.01118.20
8.3.50.0150.00420.21
8.3.40.0110.01118.92
8.3.30.0120.00418.71
8.3.20.0050.00324.18
8.3.10.0080.00024.66
8.3.00.0070.00026.16
8.2.260.0070.01116.79
8.2.250.0040.00416.72
8.2.240.0090.00019.03
8.2.230.0000.00822.58
8.2.220.0030.01337.54
8.2.210.0000.01926.77
8.2.200.0040.00416.50
8.2.190.0080.00818.41
8.2.180.0070.00725.92
8.2.170.0140.00718.95
8.2.160.0140.00722.96
8.2.150.0050.00225.66
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00421.07
8.2.110.0060.00319.43
8.2.100.0040.00819.57
8.2.90.0040.00419.05
8.2.80.0030.00517.97
8.2.70.0040.00417.50
8.2.60.0040.00418.03
8.2.50.0060.00318.07
8.2.40.0080.00018.22
8.2.30.0030.00618.14
8.2.20.0040.00420.32
8.2.10.0050.00318.12
8.2.00.0070.00019.22
8.1.310.0040.00418.68
8.1.300.0080.00018.12
8.1.290.0080.00330.84
8.1.280.0120.00325.92
8.1.270.0060.00323.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00320.86
8.1.230.0060.00622.09
8.1.220.0050.00317.79
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0040.00417.22
8.1.180.0040.00418.10
8.1.170.0080.00018.48
8.1.160.0090.00018.96
8.1.150.0040.00418.70
8.1.140.0000.00717.34
8.1.130.0000.00718.86
8.1.120.0040.00417.48
8.1.110.0060.00317.36
8.1.100.0070.00017.52
8.1.90.0060.00317.50
8.1.80.0000.00817.48
8.1.70.0040.00417.46
8.1.60.0030.00517.66
8.1.50.0070.00617.47
8.1.40.0210.00517.46
8.1.30.0200.00517.58
8.1.20.0210.00417.57
8.1.10.0200.00517.45
8.1.00.0210.00417.36
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0050.00318.37
8.0.270.0000.00716.78
8.0.260.0000.00618.37
8.0.250.0030.00317.04
8.0.240.0000.00717.02
8.0.230.0050.00216.93
8.0.220.0030.00316.97
8.0.210.0050.00216.95
8.0.200.0040.00417.06
8.0.190.0000.00816.92
8.0.180.0150.00616.88
8.0.170.0130.00816.88
8.0.160.0160.00516.86
8.0.150.0170.00516.75
8.0.140.0160.00516.81
8.0.130.0170.00416.84
8.0.120.0160.00516.87
8.0.110.0160.00516.87
8.0.100.0190.00316.88
8.0.90.0160.00416.88
8.0.80.0150.00516.83
8.0.70.0160.00416.79
8.0.60.0180.00216.91
8.0.50.0160.00516.85
8.0.30.0140.00616.87
8.0.20.0150.00616.97
8.0.10.0120.00616.94
8.0.00.0090.00616.94
7.4.330.0020.00215.55
7.4.320.0000.00716.61
7.4.300.0030.00316.54
7.4.290.0090.00616.53
7.4.280.0140.00616.45
7.4.270.0150.00716.48
7.4.260.0160.00616.44
7.4.250.0100.00516.31
7.4.240.0080.00616.49
7.4.230.0090.00516.43
7.4.220.0170.00516.45
7.4.210.0160.00616.50
7.4.200.0120.00316.44
7.4.190.0160.00216.49
7.4.180.0130.00616.50
7.4.160.0100.00416.43
7.4.150.0110.00716.46
7.4.140.0100.00416.41
7.4.130.0120.00616.32
7.4.120.0130.00516.42
7.4.110.0080.00716.32
7.4.100.0050.00816.45
7.4.90.0090.00616.36
7.4.80.0080.00516.38
7.4.70.0130.00316.45
7.4.60.0080.00616.13
7.4.50.0110.00216.36
7.4.40.0110.00416.28
7.4.30.0130.00416.37
7.4.20.0110.00616.33
7.4.10.0140.00516.43
7.4.00.0100.00616.40
7.3.330.0160.00516.29
7.3.320.0190.00116.31
7.3.310.0120.00916.33
7.3.300.0160.00516.40
7.3.290.0140.00616.36
7.3.280.0170.00416.30
7.3.270.0180.00316.40
7.3.260.0160.00416.39
7.3.250.0130.00716.37
7.3.240.0160.00616.46
7.3.230.0180.00516.33
7.3.220.0180.00316.36
7.3.210.0160.00516.24
7.3.200.0160.00616.25
7.3.190.0150.00516.29
7.3.180.0190.00216.35
7.3.170.0130.00716.29
7.3.160.0160.00316.36
7.3.150.0160.00316.17
7.3.140.0130.00816.32
7.3.130.0200.00316.23
7.3.120.0150.00516.25
7.3.110.0140.00616.16
7.3.100.0160.00316.16
7.3.90.0180.00216.54
7.3.80.0170.00316.27
7.3.70.0140.00716.29
7.3.60.0170.00416.42
7.3.50.0150.00616.45
7.3.40.0180.00516.39
7.3.30.0100.01016.37
7.3.20.0180.00516.25
7.3.10.0190.00416.32
7.3.00.0190.00616.36
7.2.340.0140.00616.21
7.2.330.0180.00316.33
7.2.320.0210.00316.18
7.2.310.0220.00216.17
7.2.300.0150.00616.19
7.2.290.0140.00716.34
7.2.280.0180.00316.32
7.2.270.0160.00516.35
7.2.260.0160.00716.35
7.2.250.0150.00716.34
7.2.240.0180.00316.24
7.2.230.0190.00416.26
7.2.220.0130.00916.21
7.2.210.0140.00816.37
7.2.200.0120.00916.37
7.2.190.0170.00516.50
7.2.180.0200.00216.53
7.2.170.0190.00216.60
7.2.160.0150.00716.60
7.2.150.0140.00816.60
7.2.140.0170.00416.43
7.2.130.0140.01016.80
7.2.120.0270.00716.71
7.2.110.0200.00316.57
7.2.100.0180.00516.54
7.2.90.0170.00716.60
7.2.80.0140.01016.45
7.2.70.0210.00216.40
7.2.60.0150.00616.51
7.2.50.0160.00716.58
7.2.40.0160.00616.68
7.2.30.0160.00616.50
7.2.20.0150.00616.53
7.2.10.0170.00516.58
7.2.00.0140.00616.58
7.1.330.0150.00615.47
7.1.320.0140.00715.54
7.1.310.0170.00315.39
7.1.300.0140.00515.42
7.1.290.0140.00515.45
7.1.280.0120.00915.46
7.1.270.0100.01015.40
7.1.260.0140.00715.36
7.1.250.0370.00615.28
7.1.240.0310.00515.24
7.1.230.0160.00515.47
7.1.220.0170.00415.36
7.1.210.0130.00515.43
7.1.200.0120.00815.45
7.1.190.0160.00415.41
7.1.180.0160.00415.25
7.1.170.0170.00415.46
7.1.160.0120.00615.46
7.1.150.0150.00415.35
7.1.140.0170.00515.50
7.1.130.0200.00015.34
7.1.120.0190.00015.42
7.1.110.0150.00515.31
7.1.100.0140.00615.30
7.1.90.0140.00615.23
7.1.80.0140.00615.52
7.1.70.0130.00815.16
7.1.60.0150.00515.47
7.1.50.0130.00715.38
7.1.40.0110.00915.51
7.1.30.0440.00615.39
7.1.20.0310.00515.37
7.1.10.0160.00515.43
7.1.00.0140.00715.38
7.0.330.0150.00415.08
7.0.320.0190.00015.14
7.0.310.0140.00415.06
7.0.300.0140.00515.04
7.0.290.0180.00314.98
7.0.280.0160.00415.21
7.0.270.0130.00715.04
7.0.260.0180.00215.14
7.0.250.0130.00715.25
7.0.240.0120.00715.21
7.0.230.0150.00515.18
7.0.220.0160.00415.03
7.0.210.0160.00315.18
7.0.200.0140.00515.27
7.0.190.0160.00315.05
7.0.180.0170.00215.14
7.0.170.0150.00415.12
7.0.160.0150.00415.04
7.0.150.0290.00615.06
7.0.140.0260.00415.03
7.0.130.0170.00315.15
7.0.120.0160.00215.16
7.0.110.0140.00415.01
7.0.100.0180.00115.04
7.0.90.0160.00314.98
7.0.80.0150.00214.86
7.0.70.0130.00515.12
7.0.60.0140.00415.02
7.0.50.0110.00815.06
7.0.40.0150.00315.18
7.0.30.0150.00415.20
7.0.20.0130.00814.98
7.0.10.0130.00715.24
7.0.00.0190.00015.23
5.6.400.0140.00415.81
5.6.390.0160.00415.93
5.6.380.0120.00615.79
5.6.370.0100.00815.74
5.6.360.0150.00215.79
5.6.350.0150.00315.91
5.6.340.0170.00115.79
5.6.330.0110.00715.72
5.6.320.0100.00915.86
5.6.310.0120.00815.82
5.6.300.0130.00515.58
5.6.290.0150.00315.88
5.6.280.0160.00215.82
5.6.270.0150.00415.78
5.6.260.0130.00415.91
5.6.250.0150.00315.85
5.6.240.0170.00215.66
5.6.230.0140.00615.94
5.6.220.0130.00615.77
5.6.210.0140.00415.81
5.6.200.0110.00715.94
5.6.190.0100.00715.91
5.6.180.0170.00215.90
5.6.170.0140.00415.87
5.6.160.0130.00415.80
5.6.150.0170.00315.78
5.6.140.0160.00215.67
5.6.130.0180.00115.69
5.6.120.0120.00715.74
5.6.110.0160.00415.73
5.6.100.0090.01015.60
5.6.90.0180.00215.68
5.6.80.0160.00215.94
5.6.70.0130.00415.93
5.6.60.0150.00315.89
5.6.50.0110.00615.91
5.6.40.0120.00715.79
5.6.30.0090.01015.71
5.6.20.0110.00615.77
5.6.10.0140.00415.65
5.6.00.0130.00615.66
5.5.380.0150.00215.78
5.5.370.0120.00415.82
5.5.360.0100.00615.43
5.5.350.0110.00515.73
5.5.340.0130.00415.56
5.5.330.0110.00615.39
5.5.320.0110.00715.52
5.5.310.0140.00315.56
5.5.300.0140.00215.53
5.5.290.0150.00115.45
5.5.280.0130.00415.46
5.5.270.0120.00615.61
5.5.260.0160.00115.51
5.5.250.0130.00615.83
5.5.240.0150.00415.64
5.5.230.0120.00515.79
5.5.220.0150.00215.82
5.5.210.0110.00615.76
5.5.200.0170.00215.46
5.5.190.0140.00415.59
5.5.180.0170.00215.50
5.5.170.0150.00215.61
5.5.160.0120.00415.55
5.5.150.0120.00615.49
5.5.140.0130.00515.50
5.5.130.0140.00315.61
5.5.120.0170.00215.38
5.5.110.0150.00315.44
5.5.100.0150.00315.72
5.5.90.0160.00315.85
5.5.80.0170.00215.78
5.5.70.0120.00615.87
5.5.60.0130.00615.65
5.5.50.0140.00215.59
5.5.40.0110.00615.62
5.5.30.0130.00415.89
5.5.20.0130.00415.60
5.5.10.0130.00615.66
5.5.00.0130.00415.63
5.4.450.0100.00512.57
5.4.440.0140.00012.42
5.4.430.0130.00212.53
5.4.420.0110.00412.55
5.4.410.0070.00712.64
5.4.400.0140.00112.63
5.4.390.0140.00012.48
5.4.380.0120.00412.48
5.4.370.0110.00412.48
5.4.360.0090.00512.48
5.4.350.0110.00412.55
5.4.340.0110.00412.54
5.4.330.0110.00512.46
5.4.320.0100.00512.60
5.4.310.0140.00312.63
5.4.300.0150.00012.68
5.4.290.0120.00312.65
5.4.280.0110.00312.61
5.4.270.0090.00612.53
5.4.260.0090.00612.51
5.4.250.0130.00312.56
5.4.240.0120.00412.50
5.4.230.0110.00412.29
5.4.220.0080.00712.49
5.4.210.0090.00612.40
5.4.200.0150.00012.43
5.4.190.0090.00612.38
5.4.180.0100.00512.45
5.4.170.0110.00412.53
5.4.160.0130.00212.47
5.4.150.0110.00312.44
5.4.140.0120.00212.63
5.4.130.0100.00312.48
5.4.120.0090.00512.42
5.4.110.0120.00312.44
5.4.100.0110.00412.38
5.4.90.0120.00212.47
5.4.80.0090.00412.56
5.4.70.0110.00312.52
5.4.60.0130.00112.49
5.4.50.0120.00112.29
5.4.40.0130.00312.44
5.4.30.0130.00312.48
5.4.20.0130.00212.50
5.4.10.0110.00312.49
5.4.00.0080.00512.23
5.3.290.0120.00213.08
5.3.280.0090.00512.88
5.3.270.0120.00313.13
5.3.260.0110.00413.06
5.3.250.0100.00412.88
5.3.240.0120.00212.71
5.3.230.0110.00312.86
5.3.220.0110.00412.84
5.3.210.0080.00713.04
5.3.200.0120.00312.83
5.3.190.0140.00112.77
5.3.180.0120.00413.23
5.3.170.0100.00513.11
5.3.160.0140.00113.13
5.3.150.0110.00513.16
5.3.140.0120.00412.96
5.3.130.0100.00512.99
5.3.120.0090.00612.92
5.3.110.0110.00512.91
5.3.100.0100.00313.08
5.3.90.0100.00513.06
5.3.80.0100.00312.92
5.3.70.0090.00512.92
5.3.60.0110.00312.83
5.3.50.0100.00312.94
5.3.40.0110.00312.81
5.3.30.0090.00512.97
5.3.20.0140.00012.79
5.3.10.0130.00012.79
5.3.00.0090.00512.71
5.2.170.0110.00212.11
5.2.160.0090.00311.87
5.2.150.0100.00211.98
5.2.140.0090.00311.95
5.2.130.0060.00511.95
5.2.120.0070.00511.92
5.2.110.0090.00312.08
5.2.100.0090.00312.07
5.2.90.0080.00311.82
5.2.80.0120.00011.77
5.2.70.0060.00611.75
5.2.60.0090.00311.71
5.2.50.0060.00611.87
5.2.40.0080.00211.95
5.2.30.0070.00411.87
5.2.20.0090.00311.75
5.2.10.0090.00311.78
5.2.00.0100.00211.59
5.1.60.0060.00310.78
5.1.50.0080.00310.93
5.1.40.0050.00511.01
5.1.30.0080.00311.08
5.1.20.0080.00310.92
5.1.10.0070.00310.98
5.1.00.0050.00510.74
5.0.50.0060.00210.00
5.0.40.0080.0019.81
5.0.30.0050.0059.72
5.0.20.0030.0069.85
5.0.10.0000.0089.83
5.0.00.0050.0039.70
4.4.90.0040.0019.42
4.4.80.0030.0029.42
4.4.70.0040.0019.42
4.4.60.0020.0049.42
4.4.50.0040.0029.42
4.4.40.0030.0039.42
4.4.30.0020.0039.42
4.4.20.0040.0019.42
4.4.10.0050.0019.42
4.4.00.0020.0029.42
4.3.110.0000.0059.42
4.3.100.0030.0029.42
4.3.90.0050.0009.42
4.3.80.0040.0019.42
4.3.70.0000.0059.42
4.3.60.0030.0029.42
4.3.50.0030.0039.42
4.3.40.0050.0009.42
4.3.30.0000.0049.42
4.3.20.0020.0029.42
4.3.10.0020.0029.42
4.3.00.0030.0019.42

preferences:
41.5 ms | 403 KiB | 5 Q