3v4l.org

run code in 300+ PHP versions simultaneously
<?php Tokens::polyfillTokenizerConstants(); Tokens::dumpMap(); Tokens::polyfillTokenizerConstants(); Tokens::dumpMap(); 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)); } public static function dumpMap() { var_dump(self::$polyfillMappingTable); } /** * 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.0370.00817.44
8.4.130.0340.00917.60
8.4.120.0360.01018.00
8.4.110.0340.01217.75
8.4.100.0400.00717.82
8.4.90.0360.01217.73
8.4.80.0380.01317.69
8.4.70.0440.00919.41
8.4.60.0380.01017.84
8.4.50.0380.00917.84
8.4.40.0400.00717.55
8.4.30.0440.00517.14
8.4.20.0400.00917.59
8.4.10.0430.00617.65
8.3.270.0370.00616.68
8.3.260.0330.01116.61
8.3.250.0380.00816.38
8.3.240.0410.00516.70
8.3.230.0390.00916.36
8.3.220.0340.01216.72
8.3.210.0400.00616.51
8.3.200.0370.00616.54
8.3.190.0370.00816.50
8.3.180.0390.00416.41
8.3.170.0370.01116.72
8.3.160.0360.01016.80
8.3.150.0360.01116.68
8.3.140.0390.00816.43
8.3.130.0310.01116.72
8.3.120.0360.01016.52
8.3.110.0330.01016.48
8.3.100.0430.00816.67
8.3.90.0360.01316.70
8.3.80.0330.01316.19
8.3.70.0400.00516.54
8.3.60.0400.00516.36
8.3.50.0370.01116.37
8.3.40.0370.00917.32
8.3.30.0300.00717.27
8.3.20.0280.00817.26
8.3.10.0290.00917.29
8.3.00.0330.00517.61
8.2.290.0300.00717.00
8.2.280.0320.00716.56
8.2.270.0320.00716.60
8.2.260.0370.00416.37
8.2.250.0310.00916.46
8.2.240.0270.01116.63
8.2.230.0330.00716.48
8.2.220.0300.00916.46
8.2.210.0320.00716.70
8.2.200.0300.00916.41
8.2.190.0330.00816.45
8.2.180.0330.00516.34
8.2.170.0340.00917.66
8.2.160.0340.00617.44
8.2.150.0300.01017.40
8.2.140.0280.01017.31
8.2.130.0310.00717.56
8.2.120.0310.00717.43
8.2.110.0340.00617.66
8.2.100.0300.01017.34
8.2.90.0350.00517.17
8.2.80.0270.01217.34
8.2.70.0340.00617.37
8.2.60.0310.00717.30
8.2.50.0320.00617.16
8.2.40.0290.00917.41
8.2.30.0290.01017.42
8.2.20.0350.00517.40
8.2.10.0350.00917.39
8.2.00.0350.00617.29
8.1.330.0270.01316.39
8.1.320.0280.00916.00
8.1.310.0270.01115.97
8.1.300.0290.00915.96
8.1.290.0280.01116.02
8.1.280.0280.01316.03
8.1.270.0340.00517.22
8.1.260.0320.00617.23
8.1.250.0300.00817.37
8.1.240.0290.00817.19
8.1.230.0310.00817.11
8.1.220.0300.00817.11
8.1.210.0270.01017.10
8.1.200.0240.01317.26
8.1.190.0310.00816.87
8.1.180.0260.01117.16
8.1.170.0290.00817.18
8.1.160.0300.01017.07
8.1.150.0340.00516.81
8.1.140.0310.01017.07
8.1.130.0340.00917.10
8.1.120.0320.00417.32
8.1.110.0260.00917.19
8.1.100.0280.00917.15
8.1.90.0310.00717.24
8.1.80.0280.00817.18
8.1.70.0330.00717.33
8.1.60.0330.00617.20
8.1.50.0310.00617.33
8.1.40.0320.00517.48
8.1.30.0310.00517.41
8.1.20.0290.00817.29
8.1.10.0340.00917.45
8.1.00.0270.01017.16
8.0.300.0240.00916.37
8.0.290.0280.00716.39
8.0.280.0270.00816.28
8.0.270.0260.00916.24
8.0.260.0270.00816.44
8.0.250.0290.00816.46
8.0.240.0260.01218.35
8.0.230.0260.00716.49
8.0.220.0290.00516.47
8.0.210.0290.00716.61
8.0.200.0260.00816.64
8.0.190.0270.00616.54
8.0.180.0310.00416.62
8.0.170.0290.00416.64
8.0.160.0270.00616.50
8.0.150.0210.01216.51
8.0.140.0240.01016.59
8.0.130.0230.01216.53
8.0.120.0280.00916.24
8.0.110.0240.01016.42
8.0.100.0250.00816.64
8.0.90.0270.00816.62
8.0.80.0280.00716.41
8.0.70.0290.00516.60
8.0.60.0270.00816.38
8.0.50.0250.00916.51
8.0.30.0290.00516.62
8.0.20.0260.00716.82
8.0.10.0270.00816.67
8.0.00.0290.00416.74
7.4.330.0300.00316.50
7.4.320.0270.00516.15
7.4.300.0260.00816.06
7.4.290.0340.00716.10
7.4.280.0240.01016.42
7.4.270.0270.01116.13
7.4.260.0310.00615.98
7.4.250.0240.00816.25
7.4.240.0250.00816.19
7.4.230.0270.00716.22
7.4.220.0270.00616.33
7.4.210.0230.00916.39
7.4.200.0240.00816.26
7.4.190.0240.01016.26
7.4.180.0330.00416.33
7.4.160.0290.00916.36
7.4.150.0290.01116.17
7.4.140.0320.00416.11
7.4.130.0270.00716.11
7.4.120.0230.01016.32
7.4.110.0240.00716.18
7.4.100.0240.00816.18
7.4.90.0250.01016.31
7.4.80.0310.00916.04
7.4.70.0240.00916.02
7.4.60.0280.00516.14
7.4.50.0290.00416.07
7.4.40.0290.00415.99
7.4.30.0220.01116.01
7.4.20.0240.00916.23
7.4.10.0240.00916.27
7.4.00.0250.00816.27
7.3.330.0270.00515.99
7.3.320.0250.00816.13
7.3.310.0220.00816.17
7.3.300.0230.00716.06
7.3.290.0260.00515.90
7.3.280.0220.00916.18
7.3.270.0200.00916.46
7.3.260.0260.01116.16
7.3.250.0260.00516.01
7.3.240.0220.00916.04
7.3.230.0280.00715.89
7.3.220.0240.00716.14
7.3.210.0240.00716.14
7.3.200.0260.00516.09
7.3.190.0220.01016.13
7.3.180.0270.00416.16
7.3.170.0240.00715.91
7.3.160.0220.01016.27
7.3.150.0280.00415.89
7.3.140.0210.00916.11
7.3.130.0260.00615.94
7.3.120.0230.00816.15
7.3.110.0270.00615.88
7.3.100.0240.00715.96
7.3.90.0230.00716.13
7.3.80.0220.00816.20
7.3.70.0220.00816.24
7.3.60.0250.00516.25
7.3.50.0250.00716.43
7.3.40.0260.00616.04
7.3.30.0290.00816.12
7.3.20.0240.00817.83
7.3.10.0260.00517.90
7.3.00.0260.00518.16
7.2.340.0260.00616.05
7.2.330.0240.00615.91
7.2.320.0260.00516.00
7.2.310.0260.00516.11
7.2.300.0220.00816.31
7.2.290.0270.00515.92
7.2.280.0200.01016.27
7.2.270.0290.00516.30
7.2.260.0210.00415.94
7.2.250.0190.00415.98
7.2.240.0260.00516.14
7.2.230.0250.00616.14
7.2.220.0260.00615.84
7.2.210.0290.00815.93
7.2.200.0270.00616.39
7.2.190.0270.01016.18
7.2.180.0220.01016.23
7.2.170.0240.00716.54
7.2.160.0250.00616.30
7.2.150.0260.00618.07
7.2.140.0240.00718.25
7.2.130.0220.00818.29
7.2.120.0240.00818.13
7.2.110.0220.00918.10
7.2.100.0270.00418.17
7.2.90.0240.00818.20
7.2.80.0220.01017.96
7.2.70.0210.01218.35
7.2.60.0230.01218.29
7.2.50.0260.00818.14
7.2.40.0190.01217.97
7.2.30.0250.00518.21
7.2.20.0230.00818.46
7.2.10.0270.00418.17
7.2.00.0250.00918.40
7.1.330.0230.00517.09
7.1.320.0220.00917.14
7.1.310.0220.00817.06
7.1.300.0230.00617.12
7.1.290.0260.00517.28
7.1.280.0250.00516.91
7.1.270.0220.00717.08
7.1.260.0210.01016.80
7.1.250.0240.00416.93
7.1.240.0270.00117.07
7.1.230.0240.00617.26
7.1.220.0210.00817.03
7.1.210.0240.00517.19
7.1.200.0260.00517.23
7.1.190.0220.00716.76
7.1.180.0220.00717.09
7.1.170.0230.00617.08
7.1.160.0220.00717.06
7.1.150.0320.00717.09
7.1.140.0250.00717.07
7.1.130.0250.00417.07
7.1.120.0230.00617.09
7.1.110.0240.00617.12
7.1.100.0220.00717.06
7.1.90.0210.00817.15
7.1.80.0260.00417.22
7.1.70.0240.00616.55
7.1.60.0260.00617.21
7.1.50.0270.00217.22
7.1.40.0210.00817.28
7.1.30.0230.00617.11
7.1.20.0210.00817.11
7.1.10.0220.00816.94
7.1.00.0170.01117.05
7.0.330.0220.00616.79
7.0.320.0230.00617.02
7.0.310.0230.00516.77
7.0.300.0210.00716.75
7.0.290.0180.01016.88
7.0.280.0270.00416.53
7.0.270.0260.00916.59
7.0.260.0210.00716.65
7.0.250.0230.00816.73
7.0.240.0230.00616.84
7.0.230.0240.00416.93
7.0.220.0210.00716.83
7.0.210.0190.00916.98
7.0.200.0240.00417.11
7.0.190.0250.00616.87
7.0.180.0230.00617.12
7.0.170.0240.00417.04
7.0.160.0230.00516.79
7.0.150.0210.00716.84
7.0.140.0210.00716.74
7.0.130.0250.00516.85
7.0.120.0240.00617.06
7.0.110.0240.00616.77
7.0.100.0210.00816.91
7.0.90.0220.00516.78
7.0.80.0260.00516.52
7.0.70.0240.01116.57
7.0.60.0210.00916.56
7.0.50.0190.00916.55
7.0.40.0210.00716.73
7.0.30.0220.00616.72
7.0.20.0240.00416.78
7.0.10.0200.00916.80
7.0.00.0260.00616.68
5.6.400.0260.00415.47
5.6.390.0210.00915.38
5.6.380.0290.00515.19
5.6.370.0270.00715.33
5.6.360.0210.00915.47
5.6.350.0250.00715.62
5.6.340.0250.00615.18
5.6.330.0220.00815.25
5.6.320.0230.00615.46
5.6.310.0230.00615.39
5.6.300.0220.00615.23
5.6.290.0240.00515.48
5.6.280.0230.01115.18
5.6.270.0260.01215.34
5.6.260.0260.00615.54
5.6.250.0220.00815.34
5.6.240.0240.00415.37
5.6.230.0230.00615.54
5.6.220.0240.00515.52
5.6.210.0210.00715.39
5.6.200.0240.00615.49
5.6.190.0230.00715.50
5.6.180.0210.00915.41
5.6.170.0230.00615.28
5.6.160.0230.00615.53
5.6.150.0210.00715.41
5.6.140.0220.00715.14
5.6.130.0220.00815.33
5.6.120.0230.00815.34
5.6.110.0220.00715.42
5.6.100.0220.00715.41
5.6.90.0200.00915.38
5.6.80.0240.00715.45
5.6.70.0280.00615.21
5.6.60.0270.00215.20
5.6.50.0180.01015.46
5.6.40.0230.00515.42
5.6.30.0260.00315.54
5.6.20.0190.01015.36
5.6.10.0240.00415.48
5.6.00.0230.00615.41
5.5.380.0200.00915.52
5.5.370.0160.01315.30
5.5.360.0280.00315.23
5.5.350.0220.00715.00
5.5.340.0280.00515.11
5.5.330.0260.00515.19
5.5.320.0220.00715.16
5.5.310.0260.00515.28
5.5.300.0260.00615.21
5.5.290.0230.00814.98
5.5.280.0220.00715.36
5.5.270.0200.00815.29
5.5.260.0180.01115.41
5.5.250.0220.01015.39
5.5.240.0210.00815.35
5.5.230.0240.00615.41
5.5.220.0250.00315.11
5.5.210.0260.00215.16
5.5.200.0210.00715.30
5.5.190.0190.00915.27
5.5.180.0200.00715.45
5.5.170.0210.00815.28
5.5.160.0240.00614.98
5.5.150.0230.00615.16
5.5.140.0210.00615.16
5.5.130.0170.01015.27
5.5.120.0230.00615.21
5.5.110.0230.00714.99
5.5.100.0200.00915.33
5.5.90.0230.00515.32
5.5.80.0220.00515.31
5.5.70.0200.01115.39
5.5.60.0240.00415.22
5.5.50.0210.00615.37
5.5.40.0260.00415.46
5.5.30.0270.01115.32
5.5.20.0240.00415.22
5.5.10.0200.00815.51
5.5.00.0210.00715.20
5.4.450.0190.00414.02
5.4.440.0180.00414.02
5.4.430.0200.00614.02
5.4.420.0160.00714.02
5.4.410.0200.00314.02
5.4.400.0200.00614.02
5.4.390.0210.00614.02
5.4.380.0170.00614.02
5.4.370.0190.00714.02
5.4.360.0190.00614.02
5.4.350.0230.00614.02
5.4.340.0200.00514.02
5.4.330.0220.00714.02
5.4.320.0210.00614.02
5.4.310.0200.00814.02
5.4.300.0190.00514.02
5.4.290.0170.00914.02
5.4.280.0200.00714.02
5.4.270.0260.00314.02
5.4.260.0200.00514.02
5.4.250.0210.00814.02
5.4.240.0180.00614.02
5.4.230.0220.00414.02
5.4.220.0170.00714.02
5.4.210.0220.00514.02
5.4.200.0170.00614.02
5.4.190.0230.00314.02
5.4.180.0170.00514.02
5.4.170.0200.00614.02
5.4.160.0190.00514.02
5.4.150.0200.00514.02
5.4.140.0160.00914.02
5.4.130.0210.00414.02
5.4.120.0210.00614.02
5.4.110.0210.00314.02
5.4.100.0170.00614.02
5.4.90.0220.00314.02
5.4.80.0200.00514.02
5.4.70.0270.00214.02
5.4.60.0160.00814.02
5.4.50.0200.00514.02
5.4.40.0220.00414.02
5.4.30.0210.00414.02
5.4.20.0200.00414.02
5.4.10.0150.00814.02
5.4.00.0200.00814.02
5.3.290.0200.00614.02
5.3.280.0150.00914.02
5.3.270.0190.00614.02
5.3.260.0190.00714.02
5.3.250.0210.00614.02
5.3.240.0210.00714.02
5.3.230.0170.00514.02
5.3.220.0230.00414.02
5.3.210.0180.00414.02
5.3.200.0200.00814.02
5.3.190.0200.00714.02
5.3.180.0200.00514.02
5.3.170.0170.00614.02
5.3.160.0180.00614.02
5.3.150.0200.00514.02
5.3.140.0220.00314.02
5.3.130.0210.00714.02
5.3.120.0220.00514.02
5.3.110.0180.00714.02
5.3.100.0190.00714.02
5.3.90.0200.00414.02
5.3.80.0150.00914.02
5.3.70.0190.00514.02
5.3.60.0250.00414.02
5.3.50.0200.00614.02
5.3.40.0170.00614.02
5.3.30.0170.00814.02
5.3.20.0180.00414.02
5.3.10.0210.00614.02
5.3.00.0180.00514.02
5.2.170.0120.00814.02
5.2.160.0130.00614.02
5.2.150.0180.00214.02
5.2.140.0160.00514.02
5.2.130.0150.00714.02
5.2.120.0160.00314.02
5.2.110.0150.00614.02
5.2.100.0110.00914.02
5.2.90.0160.00514.02
5.2.80.0140.00514.02
5.2.70.0180.00614.02
5.2.60.0130.00614.02
5.2.50.0160.00414.02
5.2.40.0130.00614.02
5.2.30.0140.00714.02
5.2.20.0150.00414.02
5.2.10.0160.00614.02
5.2.00.0170.00414.02
5.1.60.0120.00614.02
5.1.50.0130.00514.02
5.1.40.0110.00714.02
5.1.30.0120.00914.02
5.1.20.0190.00314.02
5.1.10.0120.00514.02
5.1.00.0120.00514.02
5.0.50.0130.00214.02
5.0.40.0110.00214.02
5.0.30.0100.00514.02
5.0.20.0110.00414.02
5.0.10.0120.00314.02
5.0.00.0150.00514.02
4.4.90.0080.00114.02
4.4.80.0060.00214.02
4.4.70.0060.00314.02
4.4.60.0080.00114.02
4.4.50.0080.00014.02
4.4.40.0060.00214.02
4.4.30.0080.00114.02
4.4.20.0090.00014.02
4.4.10.0100.00014.02
4.4.00.0090.00014.02
4.3.110.0060.00214.02
4.3.100.0070.00114.02
4.3.90.0070.00114.02
4.3.80.0080.00114.02
4.3.70.0080.00114.02
4.3.60.0060.00214.02
4.3.50.0080.00114.02
4.3.40.0090.00114.02
4.3.30.0060.00114.02
4.3.20.0030.00214.02
4.3.10.0060.00114.02
4.3.00.0070.00014.02

preferences:
30.41 ms | 403 KiB | 5 Q