3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* testNotAcceptedTypeExceptionOutsideAttribute1 */ /** * Docblock */ #[Attribute] function notAcceptedTokenOutsideAttributeTest() {} /* testNotAcceptedTypeExceptionOutsideAttribute2 */ echo 'notAcceptedTokenOutsideAttributeTest'; /* testAcceptedTokens */ #[AttributeName(10), \AnotherAttribute, namespace\ThirdAttribute(self::CONSTANT, 'foo')] function acceptedTokensAttributeTarget() {} /* testFindUnscopedConst */ #[MyAttribute] const UNSCOPED = true; array_map( /* testFindUnscopedClosure */ #[MyAttribute] function($a) { return $a++; }, $array ); /* testFindUnscopedClosureStatic */ $closure = #[MyAttribute] static function($a) {}; array_map( /* testFindUnscopedArrowFunction */ #[MyAttribute] fn($a) => $a++, $array ); /* testFindUnscopedArrowFunctionStatic */ $closure = #[MyAttribute] static fn ($a) => $a * 10; function hasParamAttributes( /* testFindFunctionParameter */ #[MyAttribute] #[AnotherAttribute] $paramA, /* testFindFunctionParameterTypedNullable */ #[MyAttribute] ?int $paramB, /* testFindFunctionParameterTypedUnion */ #[MyAttribute] int|false $paramC, /* testFindFunctionParameterWithRef */ #[MyAttribute] // Unrelated comment &$paramD, /* testFindFunctionParameterWithSpread */ #[MyAttribute] /** docblock */ ...$paramE, /* testFindFunctionParameterAllTogetherNow */ #[MyAttribute] (\Foo|Partial\Bar|namespace\Other)|array &...$paramF, ) {} /* testFindClass */ #[MyAttribute] class classHasAttribute {} /* testFindClassFinal */ #[MyAttribute] /** * Docblock. */ #[AnotherAttribute] final class finalClass {} /* testFindClassReadonly */ #[MyAttribute] readonly class readonlyClass {} /* testFindClassAbstract */ #[MyAttribute] abstract class abstractClass {} /* testFindClassFinalReadonly */ #[MyAttribute] // Unrelated comment. // Another unrelated comment. final readonly class finalReadonlyClass {} /* testFindAnonClass */ $anon = new #[MyAttribute] #[SecondAttribute] class {}; /* testFindAnonClassReadonly */ $anon = new #[MyAttribute] readonly class {}; /* testFindTrait */ #[MyAttribute(10), \Another] trait traitHasAttribute {} /* testFindInterface */ #[MyAttribute] #[AnotherAttributeWithBlankLinesAroundIt( name: VALUE, other_name: VALUE, )]

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.120.0370.00917.80
8.4.110.0410.00917.89
8.4.100.0400.01017.75
8.4.90.0440.00617.91
8.4.80.0400.01117.58
8.4.70.0470.00817.83
8.4.60.0380.00917.34
8.4.50.0200.00517.23
8.4.40.0190.00517.32
8.4.30.0230.00417.08
8.4.20.0210.00717.61
8.4.10.0300.00717.41
8.3.250.0370.00516.30
8.3.240.0300.00816.17
8.3.230.0370.00816.68
8.3.220.0330.01016.15
8.3.210.0160.00616.64
8.3.200.0170.00416.56
8.3.190.0280.00716.50
8.3.180.0190.00516.26
8.3.170.0230.00516.54
8.3.160.0240.01016.38
8.3.150.0480.00716.49
8.3.140.0200.00316.67
8.3.130.0160.00416.85
8.3.120.0150.00516.72
8.3.110.0160.00416.70
8.3.100.0220.00416.52
8.3.90.0260.00616.60
8.3.80.0210.00416.65
8.3.70.0200.00416.56
8.3.60.0200.00416.55
8.3.50.0290.00516.34
8.3.40.0420.00917.78
8.3.30.0310.01017.44
8.3.20.0340.00817.64
8.3.10.0310.00517.62
8.3.00.0340.01117.55
8.2.290.0360.00816.40
8.2.280.0350.00516.36
8.2.270.0260.00416.68
8.2.260.0190.01016.36
8.2.250.0190.00816.67
8.2.240.0180.00316.57
8.2.230.0190.00216.48
8.2.220.0310.01016.38
8.2.210.0330.00816.29
8.2.200.0300.00816.46
8.2.190.0190.00516.57
8.2.180.0150.00516.48
8.2.170.0170.00417.69
8.2.160.0300.00617.40
8.2.150.0290.00817.38
8.2.140.0290.00817.53
8.2.130.0300.01017.29
8.2.120.0360.00617.57
8.2.110.0360.00917.38
8.2.100.0370.00917.26
8.2.90.0410.00717.58
8.2.80.0430.00517.34
8.2.70.0320.00917.06
8.2.60.0350.01117.16
8.2.50.0450.00917.31
8.2.40.0340.00717.37
8.2.30.0310.00917.42
8.2.20.0350.00517.36
8.2.10.0310.00817.25
8.2.00.0320.00917.40

preferences:
138.29 ms | 993 KiB | 7 Q