3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait x { public function bar() { echo 'Trait x bar()'; } public function foo() { echo 'Trait x foo()'; } } class z { use x; public function foo() { echo 'Class foo()'; } } function getClassAndTraitMethods(ReflectionClass $class) { $traitMethods = []; foreach($class->getTraits() as $trait) { foreach($trait->getMethods() as $method) { $traitMethods[] = $method; } } $traitRefs = []; foreach($traitMethods as $traitMethod) { $traitRefs[spl_object_hash($traitMethod)]=$traitMethod->name; } $classMethods = []; $classRefs = []; foreach($class->getMethods() as $classMethod) { $classMethods[]=$classMethod; $classRefs[spl_object_hash($classMethod)] = $classMethod->name; } return ['traitRefs'=>$traitRefs,'classRefs'=>$classRefs]; } $obj = new z; $ref = new ReflectionClass($obj); extract(getClassAndTraitMethods($ref)); $traitOnlyHashes = array_diff( array_keys($traitRefs), array_keys($classRefs) ); $traitOnlyMethods = array_intersect_key($traitRefs, array_flip($traitOnlyHashes)); print_r($traitRefs); print_r($classRefs); print_r($traitOnlyMethods);

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.20.0110.01118.45
8.4.10.0030.00717.80
8.3.150.0040.01517.23
8.3.140.0080.00017.03
8.3.130.0090.00618.35
8.3.120.0000.00819.16
8.3.110.0110.00720.94
8.3.100.0030.01224.06
8.3.90.0080.00026.77
8.3.80.0030.00716.63
8.3.70.0110.01116.50
8.3.60.0040.01118.43
8.3.50.0120.00722.06
8.3.40.0070.00718.89
8.3.30.0000.01418.67
8.3.20.0040.00420.77
8.3.10.0000.00721.92
8.3.00.0050.00320.78
8.2.260.0060.00317.38
8.2.250.0080.00016.99
8.2.240.0000.01017.00
8.2.230.0000.00922.58
8.2.220.0050.00337.54
8.2.210.0000.00826.77
8.2.200.0060.00318.17
8.2.190.0120.00316.63
8.2.180.0100.00716.63
8.2.170.0110.00719.02
8.2.160.0070.00722.25
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0070.00019.95
8.2.110.0060.00319.31
8.2.100.0070.00417.91
8.2.90.0000.00818.16
8.2.80.0030.00622.15
8.2.70.0050.00317.75
8.2.60.0050.00318.30
8.2.50.0050.00318.10
8.2.40.0000.00820.62
8.2.30.0040.00419.35
8.2.20.0040.00418.06
8.2.10.0000.00718.16
8.2.00.0000.00717.70
8.1.310.0080.00017.03
8.1.300.0080.00020.33
8.1.290.0100.00018.88
8.1.280.0110.00425.92
8.1.270.0060.00322.14
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00619.21
8.1.230.0030.00920.95
8.1.220.0090.00017.74
8.1.210.0000.00818.96
8.1.200.0040.00417.47
8.1.190.0100.00017.35
8.1.180.0080.00018.10
8.1.170.0040.00418.68
8.1.160.0050.00318.81
8.1.150.0070.00020.28
8.1.140.0030.00619.62
8.1.130.0030.00317.44
8.1.120.0040.00417.41
8.1.110.0030.00617.51
8.1.100.0040.00417.47
8.1.90.0050.00217.33
8.1.80.0000.00717.47
8.1.70.0030.00317.38
8.1.60.0040.00417.44
8.1.50.0050.00317.48
8.1.40.0030.00517.46
8.1.30.0080.00017.68
8.1.20.0000.00817.68
8.1.10.0070.00017.51
8.1.00.0000.00717.40
8.0.300.0040.00420.02
8.0.290.0060.00316.88
8.0.280.0040.00418.58
8.0.270.0000.00716.82
8.0.260.0000.00716.86
8.0.250.0030.00317.03
8.0.240.0070.00016.96
8.0.230.0030.00317.00
8.0.220.0040.00416.89
8.0.210.0000.00716.86
8.0.200.0040.00417.03
8.0.190.0000.00717.09
8.0.180.0030.00517.01
8.0.170.0000.00716.96
8.0.160.0040.00416.86
8.0.150.0050.00316.82
8.0.140.0030.00516.84
8.0.130.0030.00313.49
8.0.120.0030.00516.93
8.0.110.0000.00716.87
8.0.100.0000.00717.01
8.0.90.0050.00216.86
8.0.80.0080.00716.99
8.0.70.0000.00816.93
8.0.60.0070.00017.00
8.0.50.0040.00416.87
8.0.30.0090.00917.13
8.0.20.0120.00617.40
8.0.10.0040.00416.93
8.0.00.0030.01916.59
7.4.330.0000.00515.55
7.4.320.0000.00616.58
7.4.300.0030.00316.47
7.4.290.0000.00816.52
7.4.280.0000.00716.66
7.4.270.0070.00016.66
7.4.260.0100.00016.61
7.4.250.0040.00416.42
7.4.240.0030.00316.49
7.4.230.0000.00716.37
7.4.220.0040.00416.56
7.4.210.0120.00916.61
7.4.200.0050.00216.66
7.4.160.0120.00416.64
7.4.150.0150.00917.40
7.4.140.0090.00817.86
7.4.130.0070.01016.66
7.4.120.0100.00816.57
7.4.110.0140.00316.59
7.4.100.0090.00916.56
7.4.90.0030.01316.49
7.4.80.0130.00619.39
7.4.70.0160.00016.34
7.4.60.0100.00616.51
7.4.50.0080.00516.51
7.4.40.0030.01416.44
7.4.30.0130.00316.68
7.4.00.0120.00315.08
7.3.330.0030.00313.36
7.3.320.0030.00313.42
7.3.310.0040.00416.50
7.3.300.0040.00416.40
7.3.290.0070.00016.24
7.3.280.0100.00716.33
7.3.270.0120.00617.40
7.3.260.0120.00616.59
7.3.250.0080.00916.54
7.3.240.0150.00616.51
7.3.230.0000.01816.63
7.3.210.0110.00716.35
7.3.200.0100.01316.37
7.3.190.0090.00616.42
7.3.180.0090.00616.44
7.3.170.0110.01116.65
7.3.160.0030.01816.40
7.2.330.0110.00716.84
7.2.320.0070.01016.40
7.2.310.0100.00616.69
7.2.300.0090.01316.81
7.2.290.0100.00616.55
7.2.80.0120.00916.54
7.2.60.0080.00817.03
7.2.00.0080.00819.60
7.1.200.0000.00915.59
7.1.100.0000.01118.23
7.1.70.0040.00717.30
7.1.60.0100.00317.20
7.1.50.0070.00317.14
7.1.00.1070.06020.73
7.0.200.0250.00714.55
7.0.140.0100.05720.32
7.0.130.1200.04720.33
7.0.120.1000.06720.36
7.0.110.1070.05320.34
7.0.100.1870.07020.42
7.0.90.0870.06020.40
7.0.80.1030.05320.17
7.0.70.0070.08020.36
7.0.60.1430.06320.29
7.0.50.0870.06320.21
7.0.40.1230.07320.20
7.0.30.0770.05320.18
7.0.20.0800.07320.21
7.0.10.0630.07320.37
7.0.00.1400.05320.17
5.6.290.0070.06020.82
5.6.280.0130.05321.13
5.6.270.0030.06321.12
5.6.260.0130.05720.82
5.6.250.0100.05720.93
5.6.240.0100.06020.74
5.6.230.0100.06320.94
5.6.220.0100.05720.97
5.6.210.0130.08720.93
5.6.200.0130.05720.93
5.6.190.0170.08021.08
5.6.180.0300.06720.92
5.6.170.0170.07320.92
5.6.160.0270.05721.04
5.6.150.0070.06321.03
5.6.140.0170.06321.05
5.6.130.0200.04720.74
5.6.120.0130.06721.02
5.6.110.0200.08020.99
5.6.100.0170.08020.83
5.6.90.0100.06320.84
5.6.80.0030.06320.43
5.6.70.0070.05720.25
5.6.60.0070.06320.41
5.6.50.0130.06020.45
5.6.40.0200.07320.40
5.6.30.0130.06020.42
5.6.20.0200.07020.45
5.6.10.0030.06720.27
5.6.00.0100.05720.42

preferences:
71.81 ms | 403 KiB | 5 Q