3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Context { private static $_context = []; public static function get($dependency) { return isset(self::$_context[$dependency]) ? self::$_context[$dependency] : null; } public static function register($dependencies) { if (!is_array($dependencies)) { throw new Exception("Неверное значение параметра для добавления зависимости в контекст"); } foreach ($dependencies as $key => $value) { self::$_context[$key] = $value instanceof Closure ? $value() : $value; } } } Context::register([ "test" => function() { return "callback"; } ]); echo Context::get("test");

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.0110.00716.63
8.3.60.0190.00318.43
8.3.50.0100.00822.02
8.3.40.0040.01118.96
8.3.30.0070.00718.76
8.3.20.0070.00020.34
8.3.10.0080.00020.48
8.3.00.0030.00520.28
8.2.190.0100.00718.16
8.2.180.0040.01116.88
8.2.170.0140.00322.96
8.2.160.0110.00422.01
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00017.50
8.2.120.0090.00026.35
8.2.110.0060.00319.45
8.2.100.0080.00420.01
8.2.90.0090.00019.34
8.2.80.0030.00617.97
8.2.70.0000.00817.75
8.2.60.0050.00518.03
8.2.50.0030.00618.09
8.2.40.0000.00820.59
8.2.30.0070.00019.58
8.2.20.0000.00717.73
8.2.10.0040.00418.04
8.2.00.0040.00418.20
8.1.280.0040.01125.92
8.1.270.0060.00323.73
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0030.00619.18
8.1.230.0060.00618.95
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0090.00017.35
8.1.180.0000.00818.10
8.1.170.0030.00518.60
8.1.160.0050.00320.79
8.1.150.0050.00218.79
8.1.140.0040.00419.60
8.1.130.0000.00717.64
8.1.120.0000.00717.46
8.1.110.0040.00417.51
8.1.100.0030.00517.56
8.1.90.0060.00317.54
8.1.80.0080.00017.45
8.1.70.0000.00717.52
8.1.60.0100.00017.58
8.1.50.0030.00617.50
8.1.40.0040.00417.55
8.1.30.0060.00317.70
8.1.20.0040.00417.57
8.1.10.0080.00017.50
8.1.00.0040.00417.36
8.0.300.0070.00018.77
8.0.290.0000.00716.75
8.0.280.0030.00318.55
8.0.270.0080.00017.29
8.0.260.0000.00717.29
8.0.250.0070.00016.93
8.0.240.0040.00416.87
8.0.230.0080.00017.00
8.0.220.0040.00416.90
8.0.210.0080.00016.89
8.0.200.0040.00416.98
8.0.190.0070.00017.04
8.0.180.0070.00016.80
8.0.170.0050.00316.89
8.0.160.0030.00316.98
8.0.150.0070.00016.78
8.0.140.0040.00416.82
8.0.130.0000.00613.34
8.0.120.0080.00016.80
8.0.110.0040.00416.79
8.0.100.0000.00816.85
8.0.90.0000.00716.82
8.0.80.0100.00616.80
8.0.70.0080.00016.79
8.0.60.0030.00517.00
8.0.50.0000.00816.86
8.0.30.0050.01117.01
8.0.20.0060.01417.40
8.0.10.0050.00216.93
8.0.00.0100.00816.88
7.4.330.0020.00216.67
7.4.320.0060.00016.51
7.4.300.0030.00316.47
7.4.290.0000.00716.60
7.4.280.0030.00516.63
7.4.270.0000.00716.44
7.4.260.0000.00716.49
7.4.250.0040.00416.41
7.4.240.0030.00316.55
7.4.230.0040.00416.64
7.4.220.0100.01016.63
7.4.210.0120.00316.42
7.4.200.0040.00416.43
7.4.160.0100.01316.66
7.4.150.0070.01017.40
7.4.140.0140.00617.86
7.4.130.0080.00916.53
7.4.120.0110.00916.50
7.4.110.0100.00716.70
7.4.100.0060.02016.66
7.4.90.0110.00516.55
7.4.80.0100.00719.39
7.4.70.0140.00316.77
7.4.60.0030.01316.51
7.4.50.0050.00816.46
7.4.40.0130.00316.34
7.4.30.0100.00616.57
7.4.00.0090.00615.09
7.3.330.0070.00013.37
7.3.320.0030.00313.29
7.3.310.0000.00716.23
7.3.300.0040.00316.37
7.3.290.0060.01016.33
7.3.280.0040.01116.37
7.3.270.0130.01017.40
7.3.260.0150.00916.71
7.3.250.0110.00816.55
7.3.240.0120.01016.48
7.3.230.0060.01216.39
7.3.210.0100.01016.65
7.3.200.0080.00819.39
7.3.190.0110.00716.41
7.3.180.0140.00616.34
7.3.170.0090.00616.54
7.3.160.0030.01316.61
7.3.10.0280.00715.76
7.3.00.0270.00715.72
7.2.330.0100.00916.73
7.2.320.0100.00716.56
7.2.310.0110.00616.50
7.2.300.0100.00616.67
7.2.290.0120.00916.76
7.2.130.0250.00816.12
7.2.120.0250.00416.01
7.2.110.0290.01315.81
7.2.100.0320.01216.01
7.2.90.0180.00816.13
7.2.80.0270.01215.96
7.2.70.0500.00515.91
7.2.60.0190.00816.31
7.2.50.0270.00616.27
7.2.40.0200.01016.10
7.2.30.0260.00815.93
7.2.20.0220.01315.75
7.2.10.0240.01215.88
7.2.00.0140.01217.11
7.1.250.0250.00514.93
7.1.240.0450.00814.03
7.1.230.0400.01514.18
7.1.220.0590.00314.13
7.1.210.0560.00613.69
7.1.200.0270.00815.04
7.1.190.0400.01213.96
7.1.180.0450.01214.09
7.1.170.0380.00013.82
7.1.160.0470.00314.00
7.1.150.0510.01214.17
7.1.140.0640.01214.04
7.1.130.0610.01813.66
7.1.120.0450.01513.91
7.1.110.0530.00314.16
7.1.100.0250.00916.13
7.1.90.0530.00413.91
7.1.80.0510.00213.98
7.1.70.0240.00515.62
7.1.60.0220.01316.72
7.1.50.0390.01413.91
7.1.40.0350.00613.88
7.1.30.0390.01014.02
7.1.20.0450.00614.12
7.1.10.0460.00914.11
7.1.00.0530.03818.29
7.0.330.0400.01313.78
7.0.320.0410.00913.64
7.0.310.0410.00913.75
7.0.300.0330.01213.46
7.0.290.0420.00713.80
7.0.280.0600.00413.66
7.0.270.0560.00413.37
7.0.260.0510.00413.59
7.0.250.0550.00713.66
7.0.240.0450.01113.62
7.0.230.0420.00813.69
7.0.220.0530.00013.75
7.0.210.0420.00413.43
7.0.200.0180.00515.14
7.0.190.0500.00413.62
7.0.180.0530.00413.77
7.0.170.0450.00713.71
7.0.160.0330.01213.43
7.0.150.0570.00813.64
7.0.140.0420.00613.48
7.0.130.0400.00413.78
7.0.120.0470.00913.71
7.0.110.0480.01213.57
7.0.100.0470.01413.73
7.0.90.0320.00913.71
7.0.80.0460.01213.21
7.0.70.0520.01313.73
7.0.60.0490.04216.84
7.0.50.0280.02515.85
7.0.40.0300.04416.90
7.0.30.0370.02017.00
7.0.20.0340.02216.95
7.0.10.0200.04217.04
7.0.00.0250.02716.85
5.6.380.0050.01814.41
5.6.370.0190.01114.66
5.6.360.0080.01014.49
5.6.350.0140.01014.12
5.6.340.0140.00514.36
5.6.330.0100.01014.34
5.6.320.0090.01214.57
5.6.310.0120.00914.70
5.6.300.0220.00914.64
5.6.290.0190.00614.70
5.6.280.0190.00814.43
5.6.270.0140.01114.22
5.6.260.0170.01514.43
5.6.250.0090.00914.64
5.6.240.0170.01014.47
5.6.230.0190.00914.28
5.6.220.0150.01514.30
5.6.210.0110.04417.48
5.6.200.0080.04616.36
5.6.190.0080.04717.41
5.6.180.0140.03217.43
5.6.170.0250.04017.37
5.6.160.0060.04817.46
5.6.150.0080.03216.27
5.6.140.0240.01516.30
5.6.130.0080.04816.26
5.6.120.0100.04517.75
5.6.110.0120.04617.68
5.6.100.0120.02517.72
5.6.90.0110.02617.69
5.6.80.0080.04917.36
5.6.70.0120.00914.31
5.6.60.0120.01214.29
5.6.50.0050.01014.22
5.6.40.0190.01314.46
5.6.30.0120.00914.51
5.6.20.0160.01314.20
5.6.10.0210.01314.45
5.6.00.0100.01014.45
5.5.380.0130.00011.45
5.5.370.0180.00311.11
5.5.360.0090.00710.95
5.5.350.2190.02715.90
5.5.340.0090.02414.68
5.5.330.0110.04315.71
5.5.320.0180.03115.64
5.5.310.0190.02315.80
5.5.300.0100.03614.75
5.5.290.0080.04014.61
5.5.280.0080.02216.08
5.5.270.0160.03516.10
5.5.260.0080.04215.83
5.5.250.0060.02815.86
5.5.240.1830.02315.70
5.5.230.0070.00511.41
5.5.220.0030.00711.11
5.5.210.0130.00411.30
5.5.200.0110.00311.01
5.5.190.0150.00611.45
5.5.180.0140.00011.30
5.5.170.0040.01311.12
5.5.160.0090.00911.30
5.5.150.0130.00611.38
5.5.140.0200.00311.19
5.5.130.0120.00911.19
5.5.120.0110.00811.05
5.5.110.0150.00011.24
5.5.100.0110.00011.18
5.5.90.0150.00311.21
5.5.80.0160.00011.27
5.5.70.0130.00311.28
5.5.60.0090.00611.32
5.5.50.0130.01011.42
5.5.40.0130.00611.13
5.5.30.0110.01110.78
5.5.20.0150.01110.77
5.5.10.0160.00611.05
5.5.00.0090.00911.35

preferences:
56.38 ms | 401 KiB | 5 Q