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', 'integer' => 'is_int', 'float' => 'is_float', 'string' => 'is_string', 'resrouce' => 'is_resource' ); private function __Constrct() {} public static function initializeHandler() { set_error_handler('Typehint::handleTypehint'); 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) { 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(int $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.0100.01016.63
8.3.50.0080.00722.09
8.3.40.0100.01318.86
8.3.30.0140.00719.17
8.3.20.0080.00020.29
8.3.10.0070.00021.90
8.3.00.0080.00020.95
8.2.180.0130.01018.16
8.2.170.0140.00022.96
8.2.160.0080.00620.53
8.2.150.0090.00624.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0060.00319.23
8.2.110.0040.00720.47
8.2.100.0000.01117.91
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0000.00817.50
8.2.60.0000.00817.93
8.2.50.0000.00818.10
8.2.40.0060.00319.95
8.2.30.0000.00818.13
8.2.20.0000.00817.71
8.2.10.0080.00018.14
8.2.00.0040.00417.73
8.1.280.0090.00925.92
8.1.270.0030.00623.91
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0030.00722.16
8.1.230.0060.00620.92
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0080.00017.23
8.1.180.0000.00818.10
8.1.170.0040.00418.57
8.1.160.0030.00321.96
8.1.150.0000.00718.55
8.1.140.0070.00017.24
8.1.130.0070.00019.54
8.1.120.0030.00517.38
8.1.110.0080.00017.35
8.1.100.0000.00817.23
8.1.90.0040.00417.31
8.1.80.0040.00417.23
8.1.70.0000.00717.31
8.1.60.0000.00817.43
8.1.50.0040.00417.50
8.1.40.0090.00317.48
8.1.30.0030.00617.59
8.1.20.0000.00817.63
8.1.10.0080.00017.45
8.1.00.0000.00917.36
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0040.00418.36
8.0.270.0000.00717.31
8.0.260.0060.00017.30
8.0.250.0000.00716.98
8.0.240.0080.00016.96
8.0.230.0030.00316.73
8.0.220.0030.00316.84
8.0.210.0070.00016.73
8.0.200.0030.00316.88
8.0.190.0000.00716.90
8.0.180.0040.00416.84
8.0.170.0090.00016.79
8.0.160.0030.00316.78
8.0.150.0040.00416.76
8.0.140.0070.00316.63
8.0.130.0000.00513.20
8.0.120.0000.00816.78
8.0.110.0040.00416.75
8.0.100.0040.00416.65
8.0.90.0040.00416.82
8.0.80.0030.01916.73
8.0.70.0080.00016.72
8.0.60.0040.00416.79
8.0.50.0050.00216.60
8.0.30.0140.00517.01
8.0.20.0110.01117.40
8.0.10.0050.00216.78
8.0.00.0120.00816.82
7.4.330.0000.00615.00
7.4.320.0060.00016.37
7.4.300.0000.00716.55
7.4.290.0000.00716.54
7.4.280.0000.00716.57
7.4.270.0030.00316.45
7.4.260.0030.00616.38
7.4.250.0040.00416.39
7.4.240.0020.00516.43
7.4.230.0040.00416.40
7.4.220.0130.00316.53
7.4.210.0040.01116.45
7.4.200.0070.00016.45
7.4.160.0210.00316.43
7.4.150.0040.01517.40
7.4.140.0110.00617.86
7.4.130.0070.01216.54
7.4.120.0040.01216.45
7.4.110.0100.00716.42
7.4.100.0150.00416.70
7.4.90.0110.00716.59
7.4.80.0120.00919.39
7.4.70.0150.00616.48
7.4.60.0090.01216.64
7.4.50.0000.00716.38
7.4.40.0090.00616.50
7.4.30.0060.00916.44
7.4.10.0040.01114.39
7.4.00.0060.00714.64
7.3.330.0000.00513.39
7.3.320.0030.00313.27
7.3.310.0000.00716.27
7.3.300.0000.00716.31
7.3.290.0030.01316.33
7.3.280.0100.00816.28
7.3.270.0030.01417.40
7.3.260.0170.00916.32
7.3.250.0120.00616.50
7.3.240.0090.00916.64
7.3.230.0100.00716.39
7.3.210.0100.00716.35
7.3.200.0140.00319.39
7.3.190.0090.01316.25
7.3.180.0100.00716.07
7.3.170.0100.00716.30
7.3.160.0030.01316.48
7.3.130.0100.00714.48
7.3.120.0120.00714.75
7.3.110.0100.01014.67
7.3.100.0120.00415.07
7.3.90.0060.01214.64
7.3.80.0040.00814.43
7.3.70.0030.01014.62
7.3.60.0070.00714.54
7.3.50.0090.00614.88
7.3.40.0080.00414.84
7.3.30.0040.01114.74
7.3.20.0080.00416.70
7.3.10.0080.00716.38
7.3.00.0050.00716.47
7.2.330.0140.00316.30
7.2.320.0170.00016.64
7.2.310.0090.00916.52
7.2.300.0080.00816.72
7.2.290.0160.00016.76
7.2.260.0040.01814.78
7.2.250.0040.01514.73
7.2.240.0000.01215.03
7.2.230.0100.00614.70
7.2.220.0040.01214.69
7.2.210.0080.00614.57
7.2.200.0120.00314.75
7.2.190.0090.00915.00
7.2.180.0030.01214.93
7.2.170.0070.00614.90
7.2.160.0040.01114.90
7.2.150.0060.00316.79
7.2.140.0000.01816.41
7.2.130.0050.00716.90
7.2.120.0050.01016.65
7.2.110.0070.00616.63
7.2.100.0080.00816.58
7.2.90.0050.01016.67
7.2.80.0050.01116.60
7.2.70.0020.01016.56
7.2.60.0070.00616.72
7.2.50.0070.00716.71
7.2.40.0000.01416.72
7.2.30.0050.00916.88
7.2.20.0030.01116.46
7.2.10.0020.01116.38
7.2.00.0050.01017.59
7.1.330.0090.00315.64
7.1.320.0100.00315.63
7.1.310.0070.00715.98
7.1.300.0030.01415.76
7.1.290.0000.00915.77
7.1.280.0030.01015.48
7.1.270.0040.00415.61
7.1.260.0070.00315.56
7.1.250.0020.00915.60
7.1.240.0090.00315.46
7.1.230.0100.00315.68
7.1.220.0060.00615.68
7.1.210.0110.00315.84
7.1.200.0020.01415.70
7.1.190.0060.00615.57
7.1.180.0040.00415.75
7.1.170.0080.00415.57
7.1.160.0060.00915.63
7.1.150.0000.00915.34
7.1.140.0060.00615.29
7.1.130.0000.00915.57
7.1.120.0070.01015.68
7.1.110.0060.00615.71
7.1.100.0010.00916.83
7.1.90.0080.00515.80
7.1.80.0110.00415.77
7.1.70.0030.00716.22
7.1.60.0080.01117.65
7.1.50.0090.00916.21
7.1.40.0030.01315.55
7.1.30.0000.00915.77
7.1.20.0060.00615.72
7.1.10.0040.00715.63
7.1.00.0050.04018.92
7.0.330.0030.00615.04
7.0.320.0000.01414.93
7.0.310.0060.00615.27
7.0.300.0040.00715.14
7.0.290.0030.01215.25
7.0.280.0080.00415.06
7.0.270.0000.01715.14
7.0.260.0090.00015.00
7.0.250.0030.01015.35
7.0.240.0030.00715.41
7.0.230.0030.00615.43
7.0.220.0030.00915.37
7.0.210.0110.00315.39
7.0.200.0070.00415.76
7.0.190.0000.00915.06
7.0.180.0070.00315.29
7.0.170.0030.01015.36
7.0.160.0000.00915.29
7.0.150.0040.01115.22
7.0.140.0000.04418.68
7.0.130.0080.00815.41
7.0.120.0030.00915.07
7.0.110.0070.00715.34
7.0.100.0020.04817.69
7.0.90.0000.04917.60
7.0.80.0020.03417.44
7.0.70.0070.03017.72
7.0.60.0080.04217.57
7.0.50.0050.04617.79
7.0.40.0020.05116.65
7.0.30.0020.03616.73
7.0.20.0050.04916.70
7.0.10.0090.03216.67
7.0.00.0080.02716.79
5.6.400.0030.00614.23
5.6.390.0060.00914.23
5.6.380.0000.01614.55
5.6.370.0030.01314.11
5.6.360.0130.00314.63
5.6.350.0070.00314.41
5.6.340.0100.00314.33
5.6.330.0100.00714.29
5.6.320.0060.00914.43
5.6.310.0060.00914.34
5.6.300.0000.01614.34
5.6.290.0040.01114.68
5.6.280.0050.04017.84
5.6.270.0090.00014.55
5.6.260.0030.01014.31
5.6.250.0060.04517.57
5.6.240.0170.02117.67
5.6.230.0050.04517.49
5.6.220.0050.04317.46
5.6.210.0050.04517.50
5.6.200.0120.04217.75
5.6.190.0030.04517.67
5.6.180.0080.04317.67
5.6.170.0050.03417.62
5.6.160.0090.04217.66
5.6.150.0040.03717.96
5.6.140.0120.04017.73
5.6.130.0080.04317.76
5.6.120.0090.04317.71
5.6.110.0070.04717.64
5.6.100.0070.04717.87
5.6.90.0120.03817.67
5.6.80.0080.03917.57
5.6.70.0100.03817.30
5.6.60.0020.03817.36
5.6.50.0100.03117.36
5.6.40.0060.04817.43
5.6.30.0120.02817.46
5.6.20.0020.03317.39
5.6.10.0020.04817.26
5.6.00.0080.04017.40
5.5.380.0050.04017.35
5.5.370.0080.04317.42
5.5.360.0100.04217.46
5.5.350.0070.04717.19
5.5.340.0110.03917.32
5.5.330.0090.04217.48
5.5.320.0030.04617.52
5.5.310.0120.04017.45
5.5.300.0120.04017.68
5.5.290.0070.03417.46
5.5.280.0080.04617.69
5.5.270.0080.04417.64
5.5.260.0070.04417.47
5.5.250.0040.03617.41
5.5.240.0170.02917.24
5.5.230.0100.04417.32
5.5.220.0060.04817.28
5.5.210.0100.03717.26
5.5.200.0030.04817.18
5.5.190.0070.05017.21
5.5.180.0100.03917.25
5.5.170.0110.00314.21
5.5.160.0100.04117.12
5.5.150.0050.02817.21
5.5.140.0030.04517.23
5.5.130.0030.03517.30
5.5.120.0030.03417.12
5.5.110.0050.03517.27
5.5.100.0100.04217.12
5.5.90.0100.03817.20
5.5.80.0080.04117.14
5.5.70.0120.03717.06
5.5.60.0050.04217.09
5.5.50.0120.03717.05
5.5.40.0100.02517.21
5.5.30.0000.04816.98
5.5.20.0030.04517.07
5.5.10.0050.03217.17
5.5.00.0080.03517.18
5.4.450.0110.04315.33
5.4.440.0060.04215.40
5.4.430.0120.03815.35
5.4.420.0100.03715.17
5.4.410.0050.04315.07
5.4.400.0110.03214.98
5.4.390.0030.04314.93
5.4.380.0030.04015.10
5.4.370.0070.03815.03
5.4.360.0080.03815.05
5.4.350.0060.04415.06
5.4.340.0060.04314.91
5.4.330.0000.01010.57
5.4.320.0080.03814.95
5.4.310.0050.04115.09
5.4.300.0040.03614.83
5.4.290.0070.03815.05
5.4.280.0030.04315.13
5.4.270.0040.04214.97
5.4.260.0070.03914.94
5.4.250.0040.04415.06
5.4.240.0060.03814.94
5.4.230.0080.04015.25
5.4.220.0050.04015.30
5.4.210.0050.04115.02
5.4.200.0030.04215.13
5.4.190.0070.03715.11
5.4.180.0050.03814.87
5.4.170.0130.03314.97
5.4.160.0100.03515.04
5.4.150.0080.03915.17
5.4.140.0030.04313.69
5.4.130.0100.03213.69
5.4.120.0030.04013.68
5.4.110.0040.04313.74
5.4.100.0020.04013.59
5.4.90.0070.04013.63
5.4.80.0070.04013.81
5.4.70.0060.04213.67
5.4.60.0020.03113.75
5.4.50.0070.03213.76
5.4.40.0070.03813.67
5.4.30.0110.02813.67
5.4.20.0020.04213.59
5.4.10.0070.04013.64
5.4.00.0060.02613.39
5.3.290.0130.03712.76
5.3.280.0120.03512.58
5.3.270.0050.04012.74
5.3.260.0100.03812.64
5.3.250.0070.04112.62
5.3.240.0060.04312.62
5.3.230.0090.03212.65
5.3.220.0110.02712.73
5.3.210.0120.03812.60
5.3.200.0090.04012.67
5.3.190.0110.03812.58
5.3.180.0120.03212.67
5.3.170.0080.04412.69
5.3.160.0090.03812.67
5.3.150.0080.04012.64
5.3.140.0080.03312.59
5.3.130.0100.03712.72
5.3.120.0070.04212.65
5.3.110.0050.02812.52
5.3.100.0080.04012.37
5.3.90.0080.04012.45
5.3.80.0090.03712.33
5.3.70.0100.03312.33
5.3.60.0080.03812.34
5.3.50.0060.03912.25
5.3.40.0070.02912.28
5.3.30.0080.03612.29
5.3.20.0040.03012.15
5.3.10.0100.03612.12
5.3.00.0140.03312.07
5.2.170.0100.05011.10
5.2.160.0000.06711.27
5.2.150.0030.06311.10
5.2.140.0030.06011.22
5.2.130.0000.06710.99
5.2.120.0030.06011.21
5.2.110.0100.03011.23
5.2.100.0170.05011.15
5.2.90.0030.06310.98
5.2.80.0030.04711.25
5.2.70.0070.05711.14
5.2.60.0030.04010.99
5.2.50.0070.06011.18
5.2.40.0070.05010.96
5.2.30.0030.06010.86
5.2.20.0100.06010.93
5.2.10.0030.04311.02
5.2.00.0030.02710.72
5.1.60.0000.05710.01
5.1.50.0030.03310.02
5.1.40.0070.05010.02
5.1.30.0030.06010.31
5.1.20.0070.04710.43
5.1.10.0030.05710.21
5.1.00.0030.05710.16
5.0.50.0070.0338.56
5.0.40.0100.0408.45
5.0.30.0030.0638.32
5.0.20.0000.0408.28
5.0.10.0000.0438.10
5.0.00.0100.0578.29
4.4.90.0030.0338.10
4.4.80.0030.0338.10
4.4.70.0130.0278.10
4.4.60.0000.0378.10
4.4.50.0030.0308.10
4.4.40.0070.0338.10
4.4.30.0030.0378.10
4.4.20.0030.0338.10
4.4.10.0000.0378.10
4.4.00.0070.0508.10
4.3.110.0030.0238.10
4.3.100.0030.0338.10
4.3.90.0000.0378.10
4.3.80.0000.0538.10
4.3.70.0070.0308.10
4.3.60.0070.0308.10
4.3.50.0070.0308.10
4.3.40.0000.0508.10
4.3.30.0000.0378.10
4.3.20.0000.0338.10
4.3.10.0030.0338.10
4.3.00.0030.0238.10

preferences:
44.3 ms | 400 KiB | 5 Q