3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Some other tool which polyfills the token constants, but doesn't care about the values at all. // If the values are not unique, the code in the Tokens::polyfillTokenizerConstants() method can not currently it. if (!defined('T_PROTECTED_SET')) { define('T_PROTECTED_SET', 10000); } if (!defined('T_ENUM')) { define('T_ENUM', 10000); } Tokens::polyfillTokenizerConstants(); var_dump(Tokens::tokenName(T_PROTECTED_SET)); var_dump(Tokens::tokenName(T_ENUM)); class Tokens { /** * Mapping table for polyfilled constants * * @var array<int, string> */ private static $polyfillMappingTable = []; public static function tokenName($token) { if (is_string($token) === true) { // PHPCS native token. return substr($token, 6); } return (self::$polyfillMappingTable[$token] ?? token_name($token)); } /** * Polyfill tokenizer (T_*) constants. * * {@internal IMPORTANT: all PHP native polyfilled tokens MUST be added to the * `PHP_CodeSniffer\Tests\Core\Util\Tokens\TokenNameTest::dataPolyfilledPHPNativeTokens()` test method!} * * @return void */ public static function polyfillTokenizerConstants(): void { // Ideally this would be a private class constant. We cannot do that // here as the constants that we are polyfilling in this method are // used in some of the class constants for this class. If we reference // any class constants or properties before this method has fully run, // PHP will intitialise the class, leading to warnings about undefined // T_* constants. $tokensToPolyfill = [ 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG', 'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG', 'T_ATTRIBUTE', 'T_BAD_CHARACTER', 'T_COALESCE_EQUAL', 'T_ENUM', 'T_FN', 'T_MATCH', 'T_NAME_FULLY_QUALIFIED', 'T_NAME_QUALIFIED', 'T_NAME_RELATIVE', 'T_NULLSAFE_OBJECT_OPERATOR', 'T_PRIVATE_SET', 'T_PROTECTED_SET', 'T_PUBLIC_SET', 'T_READONLY', ]; // <https://www.php.net/manual/en/tokens.php> // The PHP manual suggests "using big numbers like 10000" for // polyfilled T_* constants. We have arbitrarily chosen to start our // numbering scheme from 135_000. $nextTokenNumber = 135000; $polyfillMappingTable = []; foreach ($tokensToPolyfill as $tokenName) { if (defined($tokenName) === false) { while (isset($polyfillMappingTable[$nextTokenNumber]) === true) { $nextTokenNumber++; } define($tokenName, $nextTokenNumber); } $polyfillMappingTable[constant($tokenName)] = $tokenName; } // Be careful to not reference this class anywhere in this method until // *after* all constants have been polyfilled. self::$polyfillMappingTable = $polyfillMappingTable; } }

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.140.0380.00817.46
8.4.130.0380.00617.77
8.4.120.0390.00618.00
8.4.110.0360.01017.69
8.4.100.0400.00718.13
8.4.90.0390.00717.63
8.4.80.0350.01018.00
8.4.70.0410.00717.68
8.4.60.0380.00917.82
8.4.50.0370.00817.65
8.4.40.0350.01217.61
8.4.30.0420.00617.53
8.4.20.0370.01017.57
8.4.10.0380.00917.32
8.3.270.0340.01116.65
8.3.260.0410.00616.57
8.3.250.0410.01016.58
8.3.240.0330.00916.41
8.3.230.0310.01216.58
8.3.220.0350.00916.52
8.3.210.0340.01016.59
8.3.200.0330.01016.71
8.3.190.0360.00916.70
8.3.180.0350.01016.61
8.3.170.0330.01316.53
8.3.160.0380.00716.58
8.3.150.0400.00716.84
8.3.140.0330.01216.52
8.3.130.0300.01216.75
8.3.120.0360.00716.90
8.3.110.0380.01116.64
8.3.100.0350.01316.56
8.3.90.0360.01016.81
8.3.80.0390.00816.39
8.3.70.0380.00916.47
8.3.60.0380.00716.61
8.3.50.0330.01216.43
8.3.40.0380.00717.51
8.3.30.0270.01017.38
8.3.20.0300.00717.47
8.3.10.0300.00617.70
8.3.00.0320.00617.34
8.2.290.0270.00916.63
8.2.280.0270.01116.29
8.2.270.0310.00816.34
8.2.260.0340.00616.33
8.2.250.0320.00516.54
8.2.240.0320.00616.25
8.2.230.0290.00916.54
8.2.220.0280.00916.39
8.2.210.0310.01016.51
8.2.200.0320.00816.54
8.2.190.0280.01116.39
8.2.180.0290.00916.48
8.2.170.0310.00717.82
8.2.160.0300.00917.56
8.2.150.0330.00817.59
8.2.140.0290.01017.36
8.2.130.0300.01017.25
8.2.120.0310.01317.47
8.2.110.0330.00717.65
8.2.100.0290.00917.49
8.2.90.0330.00717.65
8.2.80.0290.00817.63
8.2.70.0280.01017.60
8.2.60.0320.00717.73
8.2.50.0340.01217.49
8.2.40.0280.01017.31
8.2.30.0290.00817.62
8.2.20.0270.01117.57
8.2.10.0320.00717.51
8.2.00.0400.01117.38
8.1.330.0290.00716.25
8.1.320.0290.00616.11
8.1.310.0350.00616.15
8.1.300.0270.01016.34
8.1.290.0320.00616.21
8.1.280.0310.00916.20
8.1.270.0320.00917.18
8.1.260.0330.00617.15
8.1.250.0290.00817.21
8.1.240.0230.01317.30
8.1.230.0320.01017.24
8.1.220.0240.01217.18
8.1.210.0260.01016.87
8.1.200.0280.00817.26
8.1.190.0300.00617.15
8.1.180.0230.01317.10
8.1.170.0260.01017.29
8.1.160.0300.00717.35
8.1.150.0290.00716.97
8.1.140.0300.00717.12
8.1.130.0300.00917.32
8.1.120.0300.01017.18
8.1.110.0250.01117.17
8.1.100.0330.00917.15
8.1.90.0260.01117.35
8.1.80.0270.01217.22
8.1.70.0320.01016.93
8.1.60.0310.00517.48
8.1.50.0280.00917.24
8.1.40.0270.00817.54
8.1.30.0290.00617.58
8.1.20.0260.01017.44
8.1.10.0340.00717.51
8.1.00.0340.01316.97
8.0.300.0260.01116.37
8.0.290.0300.00516.58
8.0.280.0230.01016.45
8.0.270.0260.00716.57
8.0.260.0260.00816.45
8.0.250.0260.00816.52
8.0.240.0250.00816.48
8.0.230.0260.00716.31
8.0.220.0300.00716.40
8.0.210.0250.00816.57
8.0.200.0220.01116.60
8.0.190.0250.00716.50
8.0.180.0210.01216.42
8.0.170.0230.01016.67
8.0.160.0200.01316.48
8.0.150.0230.01016.49
8.0.140.0260.00616.59
8.0.130.0270.01016.54
8.0.120.0310.01116.45
8.0.110.0270.00716.55
8.0.100.0250.00816.45
8.0.90.0240.01016.64
8.0.80.0280.00816.63
8.0.70.0260.00816.14
8.0.60.0280.00816.54
8.0.50.0300.00616.50
8.0.30.0270.00516.58
8.0.20.0300.00616.62
8.0.10.0260.00716.71
8.0.00.0260.00616.91
7.4.330.0240.00916.24
7.4.320.0230.00916.10
7.4.300.0230.00816.12
7.4.290.0240.00916.18
7.4.280.0260.00616.25
7.4.270.0270.00516.42
7.4.260.0300.00716.30
7.4.250.0250.00616.30
7.4.240.0280.00516.42
7.4.230.0280.00416.42
7.4.220.0230.00916.43
7.4.210.0270.00616.29
7.4.200.0250.00715.93
7.4.190.0240.01116.31
7.4.180.0280.00416.21
7.4.160.0240.00816.27
7.4.150.0260.00616.39
7.4.140.0270.00516.07
7.4.130.0240.00816.14
7.4.120.0260.00516.14
7.4.110.0230.00916.05
7.4.100.0280.00316.23
7.4.90.0260.00616.02
7.4.80.0250.00716.12
7.4.70.0260.01016.02
7.4.60.0270.00816.26
7.4.50.0220.01116.16
7.4.40.0270.00516.02
7.4.30.0270.00716.16
7.4.20.0260.00815.86
7.4.10.0220.01016.17
7.4.00.0270.00716.32
7.3.330.0260.00915.95
7.3.320.0250.00516.27
7.3.310.0260.00616.02
7.3.300.0240.00716.13
7.3.290.0220.00816.03
7.3.280.0250.00516.04
7.3.270.0210.00616.80
7.3.260.0250.00515.92
7.3.250.0210.00816.31
7.3.240.0230.00816.17
7.3.230.0220.00816.11
7.3.220.0240.01115.70
7.3.210.0300.00715.88
7.3.200.0210.01016.25
7.3.190.0240.00816.19
7.3.180.0230.00716.02
7.3.170.0230.00715.80
7.3.160.0240.00616.20
7.3.150.0240.00616.11
7.3.140.0220.00915.87
7.3.130.0240.00915.75
7.3.120.0240.00716.18
7.3.110.0210.01016.13
7.3.100.0210.00916.14
7.3.90.0220.00816.15
7.3.80.0230.00616.19
7.3.70.0220.00815.96
7.3.60.0250.00616.07
7.3.50.0220.01115.81
7.3.40.0250.00616.16
7.3.30.0230.00716.12
7.3.20.0280.00618.30
7.3.10.0230.00817.91
7.3.00.0220.00817.98
7.2.340.0230.00716.20
7.2.330.0230.00816.00
7.2.320.0260.00516.03
7.2.310.0230.00716.32
7.2.300.0200.01116.29
7.2.290.0290.00716.14
7.2.280.0230.01016.25
7.2.270.0210.00916.11
7.2.260.0260.00716.04
7.2.250.0260.00916.09
7.2.240.0220.00916.36
7.2.230.0240.00716.20
7.2.220.0220.00915.90
7.2.210.0240.00716.11
7.2.200.0250.00616.18
7.2.190.0260.00616.19
7.2.180.0220.00916.04
7.2.170.0270.00316.41
7.2.160.0280.00916.48
7.2.150.0260.00817.89
7.2.140.0260.00818.07
7.2.130.0210.01018.26
7.2.120.0240.01018.04
7.2.110.0250.00818.13
7.2.100.0290.00518.25
7.2.90.0240.00818.21
7.2.80.0240.00618.31
7.2.70.0200.01118.25
7.2.60.0220.00918.38
7.2.50.0180.01218.01
7.2.40.0240.00818.38
7.2.30.0210.01018.00
7.2.20.0220.00918.18
7.2.10.0240.00618.38
7.2.00.0230.00718.33
7.1.330.0230.00616.94
7.1.320.0170.01216.83
7.1.310.0210.00717.28
7.1.300.0210.00817.18
7.1.290.0240.00617.02
7.1.280.0230.00617.01
7.1.270.0210.00717.00
7.1.260.0270.00217.13
7.1.250.0250.00517.05
7.1.240.0260.00717.16
7.1.230.0260.00816.96
7.1.220.0210.00917.01
7.1.210.0240.00717.15
7.1.200.0270.00517.15
7.1.190.0230.00616.66
7.1.180.0230.00617.05
7.1.170.0220.00716.80
7.1.160.0200.00717.21
7.1.150.0230.00516.84
7.1.140.0220.00716.90
7.1.130.0220.00716.82
7.1.120.0250.00416.96
7.1.110.0210.00817.16
7.1.100.0270.00417.14
7.1.90.0270.00517.09
7.1.80.0260.00716.86
7.1.70.0230.00716.80
7.1.60.0190.01016.84
7.1.50.0190.01117.09
7.1.40.0270.00617.11
7.1.30.0250.00517.08
7.1.20.0190.01017.19
7.1.10.0260.00616.94
7.1.00.0270.00516.82
7.0.330.0220.00816.82
7.0.320.0250.00516.90
7.0.310.0200.00816.78
7.0.300.0260.00516.89
7.0.290.0180.01116.57
7.0.280.0210.00716.85
7.0.270.0210.00816.75
7.0.260.0220.00616.70
7.0.250.0240.00517.17
7.0.240.0210.01016.77
7.0.230.0230.00416.87
7.0.220.0220.00717.00
7.0.210.0190.00816.86
7.0.200.0220.00616.75
7.0.190.0220.00717.03
7.0.180.0210.00816.76
7.0.170.0270.00817.00
7.0.160.0230.00716.77
7.0.150.0230.00717.06
7.0.140.0240.00416.87
7.0.130.0210.00917.12
7.0.120.0210.00716.99
7.0.110.0210.00716.78
7.0.100.0220.00616.54
7.0.90.0200.00816.77
7.0.80.0230.00516.89
7.0.70.0250.00616.65
7.0.60.0210.00816.72
7.0.50.0210.00716.62
7.0.40.0240.00616.99
7.0.30.0230.00716.71
7.0.20.0290.00716.42
7.0.10.0230.00616.79
7.0.00.0210.00716.82
5.6.400.0250.00515.40
5.6.390.0270.00615.49
5.6.380.0250.00915.36
5.6.370.0220.00915.37
5.6.360.0230.01015.34
5.6.350.0230.00915.23
5.6.340.0190.00715.56
5.6.330.0110.00215.37
5.6.320.0120.00215.55
5.6.310.0090.00415.55
5.6.300.0140.00815.13
5.6.290.0190.01015.35
5.6.280.0220.00715.56
5.6.270.0270.00315.42
5.6.260.0250.00515.16
5.6.250.0230.00815.39
5.6.240.0260.00515.53
5.6.230.0260.00615.32
5.6.220.0260.00415.44
5.6.210.0240.00715.38
5.6.200.0240.00515.63
5.6.190.0250.00515.54
5.6.180.0200.01015.52
5.6.170.0210.01515.48
5.6.160.0210.01015.48
5.6.150.0220.00915.52
5.6.140.0230.01015.39
5.6.130.0230.00615.57
5.6.120.0240.00815.50
5.6.110.0280.00215.25
5.6.100.0260.00415.31
5.6.90.0210.00915.50
5.6.80.0240.00515.31
5.6.70.0230.00515.27
5.6.60.0210.00715.30
5.6.50.0180.01015.39
5.6.40.0210.00815.31
5.6.30.0210.00715.45
5.6.20.0230.00615.39
5.6.10.0260.00515.42
5.6.00.0250.01015.27
5.5.380.0220.00615.39
5.5.370.0240.00415.25
5.5.360.0290.00314.90
5.5.350.0270.00515.02
5.5.340.0210.00815.20
5.5.330.0220.00615.33
5.5.320.0250.00315.16
5.5.310.0220.00614.83
5.5.300.0210.00815.01
5.5.290.0220.00815.20
5.5.280.0130.00315.36
5.5.270.0110.00315.41
5.5.260.0130.00515.14
5.5.250.0260.00515.53
5.5.240.0210.00815.34
5.5.230.0220.00615.36
5.5.220.0220.00615.26
5.5.210.0220.00715.39
5.5.200.0230.00515.33
5.5.190.0220.00615.29
5.5.180.0220.00615.24
5.5.170.0210.00715.44
5.5.160.0220.00615.43
5.5.150.0200.00815.20
5.5.140.0210.00714.91
5.5.130.0260.00715.12
5.5.120.0210.00815.11
5.5.110.0220.00615.38
5.5.100.0260.00615.26
5.5.90.0200.00815.40
5.5.80.0250.00715.16
5.5.70.0250.00515.44
5.5.60.0250.00615.18
5.5.50.0260.00415.36
5.5.40.0250.00615.46
5.5.30.0190.01015.38
5.5.20.0270.00315.52
5.5.10.0270.01014.96
5.5.00.0260.00715.21
5.4.450.0180.00514.02
5.4.440.0200.00314.02
5.4.430.0210.00314.02
5.4.420.0170.00614.02
5.4.410.0150.00714.02
5.4.400.0190.00514.02
5.4.390.0200.00314.02
5.4.380.0200.00514.02
5.4.370.0210.00514.02
5.4.360.0200.00714.02
5.4.350.0160.00714.02
5.4.340.0170.00514.02
5.4.330.0180.00414.02
5.4.320.0180.00414.02
5.4.310.0170.00614.02
5.4.300.0190.00314.02
5.4.290.0160.00614.02
5.4.280.0190.00414.02
5.4.270.0170.00614.02
5.4.260.0160.00814.02
5.4.250.0170.00714.02
5.4.240.0170.00614.02
5.4.230.0200.00414.02
5.4.220.0160.00614.02
5.4.210.0150.00814.02
5.4.200.0160.00614.02
5.4.190.0170.00614.02
5.4.180.0170.00614.02
5.4.170.0180.00414.02
5.4.160.0180.00514.02
5.4.150.0190.00414.02
5.4.140.0200.00214.02
5.4.130.0170.00514.02
5.4.120.0180.00414.02
5.4.110.0180.00414.02
5.4.100.0170.00514.02
5.4.90.0190.00814.02
5.4.80.0190.00614.02
5.4.70.0190.00514.02
5.4.60.0180.00714.02
5.4.50.0170.00414.02
5.4.40.0200.00314.02
5.4.30.0190.00314.02
5.4.20.0170.00514.02
5.4.10.0180.00414.02
5.4.00.0170.00414.02
5.3.290.0170.00514.02
5.3.280.0170.00514.02
5.3.270.0190.00414.02
5.3.260.0200.00314.02
5.3.250.0180.00614.02
5.3.240.0180.00414.02
5.3.230.0160.00714.02
5.3.220.0180.00414.02
5.3.210.0180.00514.02
5.3.200.0180.00514.02
5.3.190.0200.00414.02
5.3.180.0200.00714.02
5.3.170.0200.00614.02
5.3.160.0190.00314.02
5.3.150.0150.00714.02
5.3.140.0190.00314.02
5.3.130.0190.00514.02
5.3.120.0180.00514.02
5.3.110.0210.00414.02
5.3.100.0170.00514.02
5.3.90.0170.00514.02
5.3.80.0150.00914.02
5.3.70.0180.00514.02
5.3.60.0190.00514.02
5.3.50.0150.00714.02
5.3.40.0170.00514.02
5.3.30.0150.00614.02
5.3.20.0170.00414.02
5.3.10.0160.00514.02
5.3.00.0160.00614.02
5.2.170.0100.00814.02
5.2.160.0110.00714.02
5.2.150.0160.00214.02
5.2.140.0100.00714.02
5.2.130.0150.00314.02
5.2.120.0150.00314.02
5.2.110.0140.00414.02
5.2.100.0130.00614.02
5.2.90.0100.00814.02
5.2.80.0150.00414.02
5.2.70.0120.00514.02
5.2.60.0140.00414.02
5.2.50.0110.00614.02
5.2.40.0120.00514.02
5.2.30.0090.00814.02
5.2.20.0120.00514.02
5.2.10.0140.00414.02
5.2.00.0140.00314.02
5.1.60.0140.00414.02
5.1.50.0130.00414.02
5.1.40.0140.00514.02
5.1.30.0140.00314.02
5.1.20.0100.00614.02
5.1.10.0130.00614.02
5.1.00.0110.00514.02
5.0.50.0100.00414.02
5.0.40.0110.00314.02
5.0.30.0130.00214.02
5.0.20.0090.00514.02
5.0.10.0090.00514.02
5.0.00.0090.00414.02
4.4.90.0070.00014.02
4.4.80.0070.00114.02
4.4.70.0040.00414.02
4.4.60.0080.00014.02
4.4.50.0070.00214.02
4.4.40.0070.00114.02
4.4.30.0060.00214.02
4.4.20.0060.00214.02
4.4.10.0070.00114.02
4.4.00.0060.00314.02
4.3.110.0090.00114.02
4.3.100.0090.00114.02
4.3.90.0070.00114.02
4.3.80.0070.00114.02
4.3.70.0070.00114.02
4.3.60.0070.00114.02
4.3.50.0070.00114.02
4.3.40.0070.00114.02
4.3.30.0040.00214.02
4.3.20.0030.00314.02
4.3.10.0040.00214.02
4.3.00.0050.00214.02

preferences:
33.34 ms | 403 KiB | 5 Q