3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_PROPERTY)] ## Look ma, I'm not targeting parameter with Attribute::TARGET_PARAMETER final class TargetTestPropertyAttribute { } final class TargetTest { public function __construct( #[TargetTestAttribute] public string $test ) { } } $ref = new ReflectionClass(TargetTest::class); $testAsProperty = $ref->getProperty('test'); $testAsParemter = $ref->getConstructor()->getParameters()[0]; // Property echo $testAsProperty->getAttributes()[0]->getTarget() === Attribute::TARGET_PROPERTY ? "Attribute targets property\n" : "Attribute does not target property\n"; // Parameter echo $testAsParemter->getAttributes()[0]->getTarget() === Attribute::TARGET_PARAMETER ? "Attribute targets parameter (why?)\n" : "Attribute does not target parameter\n";

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.5.30.0120.00519.66
8.5.20.0130.00620.09
8.5.10.0090.00916.70
8.5.00.0120.00920.05
8.4.180.0140.00722.01
8.4.170.0090.01223.90
8.4.160.0100.01423.93
8.4.150.0020.00014.05
8.4.140.0110.01017.55
8.4.130.0090.01117.78
8.4.120.0040.00520.79
8.4.110.0120.00819.00
8.4.100.0120.00817.57
8.4.90.0130.00718.07
8.4.80.0220.00318.73
8.4.70.0260.01017.43
8.4.60.0190.00417.97
8.4.50.0160.00517.72
8.4.40.0170.00617.39
8.4.30.0190.00417.38
8.4.20.0200.00317.33
8.4.10.0160.00617.52
8.3.300.0120.00920.95
8.3.290.0120.00720.86
8.3.280.0160.00818.30
8.3.270.0120.00716.57
8.3.260.0130.00616.51
8.3.250.0110.00718.82
8.3.240.0050.00716.54
8.3.230.0110.00916.42
8.3.220.0060.00317.00
8.3.210.0150.00716.38
8.3.200.0150.00416.40
8.3.190.0150.00416.53
8.3.180.0150.00516.47
8.3.170.0200.00416.30
8.3.160.0180.00316.41
8.3.150.0180.00416.44
8.3.140.0140.00716.37
8.3.130.0160.00516.48
8.3.120.0170.00216.48
8.3.110.0150.00416.18
8.3.100.0190.00316.50
8.3.90.0190.00316.51
8.3.80.0170.00516.59
8.3.70.0170.00618.00
8.3.60.0160.00516.40
8.3.50.0210.00216.21
8.3.40.0120.00617.40
8.3.30.0130.00617.75
8.3.20.0180.00217.64
8.3.10.0190.00317.60
8.3.00.0060.00617.52
8.2.300.0100.01118.67
8.2.290.0090.01019.23
8.2.280.0130.00317.04
8.2.270.0180.00116.91
8.2.260.0130.00416.35
8.2.250.0130.00716.43
8.2.240.0140.00416.61
8.2.230.0160.00316.65
8.2.220.0140.00416.63
8.2.210.0170.00216.30
8.2.200.0150.00416.50
8.2.190.0140.00416.36
8.2.180.0150.00416.32
8.2.170.0150.00517.56
8.2.160.0160.00317.59
8.2.150.0140.00617.57
8.2.140.0160.00417.51
8.2.130.0140.00717.46
8.2.120.0150.00417.51
8.2.110.0170.00417.38
8.2.100.0130.00617.67
8.2.90.0140.00417.89
8.2.80.0120.00617.57
8.2.70.0130.00517.36
8.2.60.0140.00517.52
8.2.50.0150.00317.46
8.2.40.0170.00217.76
8.2.30.0130.00517.66
8.2.20.0160.00317.74
8.2.10.0140.00617.34
8.2.00.0160.00417.55
8.1.340.0140.00821.63

preferences:
31.17 ms | 403 KiB | 5 Q