3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('TYPEHINT_PCRE', '/^Argument (\d)+ passed to (?:(\w+)::)?(\w+)\(\) must be an instance of (\w+), (\w+) given/'); class Typehint { private static $Typehints = array( 'boolean' => 'is_bool', 'int' => 'is_int', 'integer' => 'is_int', 'float' => 'is_float', 'string' => 'is_string', 'resrouce' => 'is_resource' ); private function __Constrct() {} public static function initializeHandler() { set_error_handler('Typehint::handleTypehint', E_ALL); return TRUE; } private static function getTypehintedArgument($ThBackTrace, $ThFunction, $ThArgIndex, &$ThArgValue) { foreach ($ThBackTrace as $ThTrace) { // Match the function; Note we could do more defensive error checking. if (isset($ThTrace['function']) && $ThTrace['function'] == $ThFunction) { $ThArgValue = $ThTrace['args'][$ThArgIndex - 1]; return TRUE; } } return FALSE; } public static function handleTypehint($ErrLevel, $ErrMessage, $ErrFile, $ErrLine) { if ($ErrLevel == E_RECOVERABLE_ERROR) { if (preg_match(TYPEHINT_PCRE, $ErrMessage, $ErrMatches)) { list($ErrMatch, $ThArgIndex, $ThClass, $ThFunction, $ThHint, $ThType) = $ErrMatches; if (isset(self::$Typehints[$ThHint])) { $ThBacktrace = debug_backtrace(); $ThArgValue = NULL; if (self::getTypehintedArgument($ThBacktrace, $ThFunction, $ThArgIndex, $ThArgValue)) { if (call_user_func(self::$Typehints[$ThHint], $ThArgValue)) { return TRUE; } } } } } return false; } } Typehint::initializeHandler(); function test(string $number) { echo $number; } test("5"); test(5);

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.38
8.3.50.0150.00522.06
8.3.40.0120.00618.84
8.3.30.0100.00319.04
8.3.20.0040.00420.34
8.3.10.0060.00323.62
8.3.00.0070.00420.57
8.2.180.0100.00716.63
8.2.170.0060.01222.96
8.2.160.0070.00720.23
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00419.82
8.2.110.0060.00321.90
8.2.100.0060.00617.66
8.2.90.0040.00419.04
8.2.80.0000.00917.97
8.2.70.0060.00317.37
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0000.00818.16
8.2.30.0000.00717.94
8.2.20.0040.00417.68
8.2.10.0040.00417.56
8.2.00.0050.00217.69
8.1.280.0120.00325.92
8.1.270.0000.00822.06
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0000.00923.92
8.1.230.0050.00519.00
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0060.00317.23
8.1.190.0050.00317.28
8.1.180.0040.00418.10
8.1.170.0100.00018.20
8.1.160.0050.00221.88
8.1.150.0000.00718.52
8.1.140.0050.00217.32
8.1.130.0000.00817.76
8.1.120.0040.00417.35
8.1.110.0000.00717.22
8.1.100.0030.00417.39
8.1.90.0070.00017.37
8.1.80.0050.00317.33
8.1.70.0000.00717.12
8.1.60.0040.00417.41
8.1.50.0040.00417.48
8.1.40.0040.00417.43
8.1.30.0040.00417.48
8.1.20.0000.00717.57
8.1.10.0040.00417.41
8.1.00.0000.00817.42
8.0.300.0050.00218.77
8.0.290.0000.00717.05
8.0.280.0070.00018.34
8.0.270.0080.00017.26
8.0.260.0000.00716.88
8.0.250.0070.00017.04
8.0.240.0000.00817.05
8.0.230.0050.00316.96
8.0.220.0030.00516.85
8.0.210.0030.00316.87
8.0.200.0070.00016.95
8.0.190.0030.00616.85
8.0.180.0000.00816.93
8.0.170.0030.00516.90
8.0.160.0000.00816.82
8.0.150.0040.00416.72
8.0.140.0000.00816.81
8.0.130.0000.00513.25
8.0.120.0080.00016.83
8.0.110.0000.00716.78
8.0.100.0000.00716.86
8.0.90.0030.00516.95
8.0.80.0110.00416.91
8.0.70.0020.00516.89
8.0.60.0000.00716.77
8.0.50.0050.00316.91
8.0.30.0130.00917.14
8.0.20.0100.01017.40
8.0.10.0000.00716.86
8.0.00.0130.00616.54
7.4.330.0000.00515.02
7.4.320.0000.00716.30
7.4.300.0030.00316.56
7.4.290.0070.00016.40
7.4.280.0060.00616.58
7.4.270.0000.00616.46
7.4.260.0080.00016.53
7.4.250.0040.00416.50
7.4.240.0020.00616.49
7.4.230.0000.00716.34
7.4.220.0170.01016.48
7.4.210.0080.00616.54
7.4.200.0000.00716.53
7.4.190.0040.00416.59
7.4.160.0130.00316.39
7.4.150.0070.01017.40
7.4.140.0150.00517.86
7.4.130.0080.01016.53
7.4.120.0130.00616.63
7.4.110.0080.00816.24
7.4.100.0120.00616.48
7.4.90.0090.00916.33
7.4.80.0100.01019.39
7.4.70.0110.00516.60
7.4.60.0060.01016.54
7.4.50.0030.00616.25
7.4.40.0100.00722.77
7.4.30.0070.01016.55
7.4.00.0070.01014.91
7.3.330.0000.00613.25
7.3.320.0000.00613.32
7.3.310.0000.00716.20
7.3.300.0040.00416.18
7.3.290.0050.01016.39
7.3.280.0070.01216.33
7.3.270.0100.01317.40
7.3.260.0070.01016.29
7.3.250.0070.01216.58
7.3.240.0070.01016.36
7.3.230.0240.00016.43
7.3.210.0120.00616.70
7.3.200.0120.00416.32
7.3.190.0150.00916.36
7.3.180.0070.01016.64
7.3.170.0060.00916.29
7.3.160.0040.01116.28
7.3.120.0070.01015.04
7.3.110.0100.01014.91
7.3.100.0030.01114.68
7.3.90.0040.00714.77
7.3.80.0070.00415.15
7.3.70.0110.00314.65
7.3.60.0050.00514.90
7.3.50.0030.01014.82
7.3.40.0070.00714.95
7.3.30.0060.00614.78
7.3.20.0060.00316.69
7.3.10.0000.00916.71
7.3.00.0030.01016.88
7.2.330.0120.00616.45
7.2.320.0160.00616.44
7.2.310.0080.01616.59
7.2.300.0070.01016.83
7.2.290.0090.00616.71
7.2.250.0040.01214.91
7.2.240.0100.01014.96
7.2.230.0030.01314.84
7.2.220.0090.00315.16
7.2.210.0060.00614.97
7.2.200.0040.01114.80
7.2.190.0070.00715.02
7.2.180.0030.01315.07
7.2.170.0060.01015.07
7.2.60.0030.01016.75
7.1.330.0070.00715.98
7.1.320.0060.00316.02
7.1.310.0060.00615.84
7.1.300.0030.00715.80
7.1.290.0060.00315.79
7.1.280.0030.00915.61
7.1.270.0090.00615.74
7.1.260.0070.00715.81
7.1.200.0030.00615.61
7.1.70.0040.00416.87
7.1.60.0160.00919.29
7.1.50.0110.01116.98
7.1.00.0100.07022.54
7.0.200.0090.00316.73
7.0.140.0070.07022.05
7.0.60.0000.07720.01
7.0.50.0030.04318.04
7.0.40.0070.05320.20
7.0.30.0300.07720.26
7.0.20.0230.08720.15
7.0.10.0100.04320.33
7.0.00.0070.04020.25
5.6.280.0070.07021.17
5.6.210.0100.03720.71
5.6.200.0100.07718.18
5.6.190.0070.05020.77
5.6.180.0230.03320.63
5.6.170.0170.04020.41
5.6.160.0000.05320.55
5.6.150.0100.06318.13
5.6.140.0070.08318.15
5.6.130.0000.04318.26
5.6.120.0100.08021.14
5.6.110.0070.07320.98
5.6.100.0030.06720.88
5.6.90.0100.08021.12
5.6.80.0100.06020.40
5.5.350.0130.08020.32
5.5.340.0100.05017.94
5.5.330.0070.04020.21
5.5.320.0170.08020.47
5.5.310.0300.07720.30
5.5.300.0030.05717.95
5.5.290.0070.08017.93
5.5.280.0130.06320.80
5.5.270.0070.04720.78
5.5.260.0100.05320.79
5.5.250.0100.07720.70
5.5.240.0000.08320.20
5.4.450.0230.05319.20
5.4.440.0500.06319.61
5.4.430.0630.04019.63
5.4.420.0430.05719.31
5.4.410.0470.04019.18
5.4.400.0500.03719.23
5.4.390.0400.04319.09
5.4.380.0470.07318.71
5.4.370.0130.07018.77
5.4.360.0370.05018.83
5.4.350.0270.05718.55
5.4.340.0270.06018.58
5.4.320.0110.03412.52
5.4.310.0100.03612.52
5.4.300.0070.04212.52
5.4.290.0100.03512.52
5.4.280.0070.03512.41
5.4.270.0080.03512.39
5.4.260.0070.03712.39
5.4.250.0050.03912.39
5.4.240.0050.03812.39
5.4.230.0060.03712.38
5.4.220.0040.04012.38
5.4.210.0060.03612.39
5.4.200.0090.04012.38
5.4.190.0050.03712.38
5.4.180.0050.03912.38
5.4.170.0090.03412.39
5.4.160.0060.05012.39
5.4.150.0060.03612.38
5.4.140.0080.03512.07
5.4.130.0070.03512.05
5.4.120.0070.04312.01
5.4.110.0110.03412.01
5.4.100.0100.03412.01
5.4.90.0050.04012.01
5.4.80.0070.03712.00
5.4.70.0080.03212.00
5.4.60.0070.03212.00
5.4.50.0040.03712.00
5.4.40.0080.03311.99
5.4.30.0060.03611.99
5.4.20.0090.03711.99
5.4.10.0070.05111.98
5.4.00.0060.04111.48
5.3.290.0070.04612.80
5.3.280.0030.04112.71
5.3.270.0080.03812.73
5.3.260.0070.04012.72
5.3.250.0050.03912.72
5.3.240.0060.04212.72
5.3.230.0050.04112.71
5.3.220.0080.04212.68
5.3.210.0070.04312.68
5.3.200.0020.04012.68
5.3.190.0070.03912.68
5.3.180.0080.04812.67
5.3.170.0110.03312.67
5.3.160.0090.03312.67
5.3.150.0110.03212.67
5.3.140.0070.04912.66
5.3.130.0030.04212.66
5.3.120.0050.03912.66
5.3.110.0050.04012.66
5.3.100.0070.03612.12
5.3.90.0100.04312.10
5.3.80.0080.03812.08
5.3.70.0080.03512.08
5.3.60.0070.03612.07
5.3.50.0050.03812.01
5.3.40.0090.04512.01
5.3.30.0070.04211.98
5.3.20.0060.03511.76
5.3.10.0040.03711.72
5.3.00.0080.03411.70
5.2.170.0040.0309.21
5.2.160.0080.0309.21
5.2.150.0040.0409.21
5.2.140.0070.0289.21
5.2.130.0060.0359.18
5.2.120.0050.0319.17
5.2.110.0030.0339.18
5.2.100.0060.0279.18
5.2.90.0070.0339.18
5.2.80.0050.0339.18
5.2.70.0030.0339.17
5.2.60.0100.0269.13
5.2.50.0040.0349.09
5.2.40.0080.0329.07
5.2.30.0060.0319.05
5.2.20.0070.0319.05
5.2.10.0040.0308.93
5.2.00.0080.0268.78
5.1.60.0060.0238.06
5.1.50.0010.0288.07
5.1.40.0060.0268.06
5.1.30.0050.0328.41
5.1.20.0030.0288.43
5.1.10.0040.0268.15
5.1.00.0040.0268.14
5.0.50.0020.0226.63
5.0.40.0030.0206.49
5.0.30.0020.0326.31
5.0.20.0060.0236.29
5.0.10.0030.0206.25
5.0.00.0020.0326.25
4.4.90.0010.0174.78
4.4.80.0050.0174.75
4.4.70.0020.0214.76
4.4.60.0010.0204.75
4.4.50.0020.0194.77
4.4.40.0050.0274.71
4.4.30.0020.0174.75
4.4.20.0030.0154.84
4.4.10.0050.0204.85
4.4.00.0040.0294.76
4.3.110.0020.0154.67
4.3.100.0020.0164.66
4.3.90.0040.0164.64
4.3.80.0020.0254.58
4.3.70.0020.0234.63
4.3.60.0030.0194.63
4.3.50.0020.0204.63
4.3.40.0020.0254.54
4.3.30.0020.0233.28
4.3.20.0020.0153.27
4.3.10.0010.0163.23
4.3.00.0100.01013.14

preferences:
38.19 ms | 401 KiB | 5 Q