3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait x { public function foo() { echo 'Trait x foo()'; } public function bar() { echo 'Trait x bar()'; } } class z { use x; public function foo() { echo 'Class foo()'; } } function getTraitMethodsRefs(ReflectionClass $class) { $traitMethods = call_user_func_array('array_merge', array_map(function(ReflectionClass $ref) { return $ref->getMethods(); }, $class->getTraits())); $traitMethods = call_user_func_array('array_merge', array_map(function (ReflectionMethod $method) { return [spl_object_hash($method) => $method->getName()]; }, $traitMethods)); return $traitMethods; } function getClassMethodsRefs(ReflectionClass $class) { return call_user_func_array('array_merge', array_map(function (ReflectionMethod $method) { return [spl_object_hash($method) => $method->getName()]; }, $class->getMethods())); } $obj = new z; $ref = new ReflectionClass($obj); $traitRefs = getTraitMethodsRefs($ref); $classRefs = getClassMethodsRefs($ref); $traitOnlyHashes = array_diff( array_keys($traitRefs), array_keys($classRefs) ); $traitOnlyMethods = array_intersect_key($traitRefs, array_flip($traitOnlyHashes)); var_dump( $traitRefs, $classRefs, $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.3.60.0070.01416.88
8.3.50.0140.00521.10
8.3.40.0080.00818.75
8.3.30.0040.01219.01
8.3.20.0000.00820.38
8.3.10.0110.00421.80
8.3.00.0150.00319.53
8.2.180.0120.00917.00
8.2.170.0060.00919.08
8.2.160.0120.00322.96
8.2.150.0060.00624.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0080.00019.79
8.2.110.0040.00420.39
8.2.100.0070.00417.78
8.2.90.0030.00617.63
8.2.80.0050.00317.97
8.2.70.0040.00418.04
8.2.60.0040.00417.50
8.2.50.0040.00418.10
8.2.40.0060.00322.26
8.2.30.0070.00018.25
8.2.20.0060.00317.75
8.2.10.0050.00318.13
8.2.00.0040.00418.01
8.1.280.0070.01125.92
8.1.270.0060.00320.35
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0110.00023.77
8.1.230.0040.00721.03
8.1.220.0000.00817.79
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0050.00317.35
8.1.180.0030.00618.10
8.1.170.0050.00318.61
8.1.160.0040.00422.07
8.1.150.0080.00018.65
8.1.140.0090.00017.42
8.1.130.0040.00419.14
8.1.120.0040.00417.41
8.1.110.0050.00317.52
8.1.100.0050.00217.42
8.1.90.0000.00717.52
8.1.80.0070.00017.39
8.1.70.0070.00017.39
8.1.60.0040.00417.62
8.1.50.0040.00417.61
8.1.40.0030.00617.49
8.1.30.0000.00817.66
8.1.20.0040.00417.75
8.1.10.0050.00217.55
8.1.00.0090.00317.51
8.0.300.0050.00318.77
8.0.290.0000.00716.88
8.0.280.0050.00218.46
8.0.270.0000.00717.20
8.0.260.0000.00716.94
8.0.250.0000.00817.07
8.0.240.0070.00017.04
8.0.230.0030.00317.03
8.0.220.0000.00716.99
8.0.210.0000.00716.96
8.0.200.0000.00616.96
8.0.190.0070.00016.94
8.0.180.0040.00416.99
8.0.170.0050.00317.09
8.0.160.0060.00316.99
8.0.150.0000.00716.92
8.0.140.0070.00016.96
8.0.130.0050.00013.49
8.0.120.0000.00817.04
8.0.110.0030.00516.97
8.0.100.0040.00416.84
8.0.90.0030.00516.98
8.0.80.0130.00416.99
8.0.70.0050.00216.89
8.0.60.0050.00217.02
8.0.50.0030.00516.88
8.0.30.0080.01216.94
8.0.20.0100.00817.40
8.0.10.0000.00817.17
8.0.00.0080.01316.85
7.4.330.0020.00215.03
7.4.320.0030.00316.46
7.4.300.0000.00716.59
7.4.290.0000.00716.54
7.4.280.0000.00916.64
7.4.270.0000.00716.55
7.4.260.0000.00716.63
7.4.250.0080.00016.61
7.4.240.0040.00316.59
7.4.230.0030.00316.77
7.4.220.0100.00716.62
7.4.210.0040.01116.61
7.4.200.0020.00516.74
7.4.160.0090.00616.34
7.4.150.0090.00917.40
7.4.140.0120.00917.86
7.4.130.0080.01316.57
7.4.120.0110.00716.60
7.4.110.0110.00716.59
7.4.100.0030.02016.37
7.4.90.0130.00516.45
7.4.80.0040.01919.39
7.4.70.0110.00816.43
7.4.60.0100.00616.57
7.4.50.0080.00016.54
7.4.40.0140.00316.62
7.4.30.0140.00316.47
7.4.00.0070.01015.11
7.3.330.0030.00313.13
7.3.320.0030.00313.15
7.3.310.0050.00216.13
7.3.300.0000.00716.16
7.3.290.0070.00816.29
7.3.280.0090.00816.29
7.3.270.0110.00717.40
7.3.260.0070.01116.48
7.3.250.0080.01216.34
7.3.240.0160.00316.43
7.3.230.0160.00516.45
7.3.210.0090.00916.30
7.3.200.0090.00616.67
7.3.190.0080.00816.36
7.3.180.0140.00516.30
7.3.170.0150.00616.27
7.3.160.0170.00016.58
7.3.120.0090.00614.97
7.3.110.0080.00614.74
7.3.100.0000.01114.72
7.3.90.0060.00614.98
7.3.80.0040.01214.76
7.3.70.0000.01114.83
7.3.60.0090.00614.79
7.3.50.0100.00614.74
7.3.40.0120.00314.98
7.3.30.0070.01014.67
7.3.20.0070.00716.60
7.3.10.0040.01216.61
7.3.00.0080.00416.36
7.2.330.0140.00416.43
7.2.320.0080.01016.88
7.2.310.0080.00816.65
7.2.300.0090.01516.65
7.2.290.0120.01116.49
7.2.240.0090.00615.11
7.2.230.0060.01215.03
7.2.220.0060.00915.32
7.2.210.0060.00914.99
7.2.200.0060.00914.80
7.2.190.0060.00915.07
7.2.180.0030.01415.04
7.2.170.0090.00615.29
7.2.160.0090.00614.85
7.2.150.0070.00316.94
7.2.140.0070.00716.85
7.2.130.0160.00316.84
7.2.120.0030.01417.04
7.2.110.0000.01616.86
7.2.100.0040.01116.98
7.2.90.0060.00916.98
7.2.80.0070.01116.99
7.2.70.0080.00817.09
7.2.60.0050.00917.03
7.2.50.0130.00316.68
7.2.40.0030.01416.93
7.2.30.0060.00916.94
7.2.20.0130.00616.93
7.2.10.0080.00516.77
7.2.00.0060.01016.79
7.1.330.0030.00915.98
7.1.320.0100.00715.69
7.1.310.0070.00315.81
7.1.300.0070.00315.75
7.1.290.0060.00615.80
7.1.280.0060.00915.50
7.1.270.0040.00715.77
7.1.260.0070.00715.79
7.1.250.0000.01715.62
7.1.200.0060.00315.78
7.1.70.0000.01617.11
7.1.60.0040.02219.86
7.1.50.0100.02134.73
7.1.00.0070.07022.48
7.0.200.0050.00316.64
7.0.100.0130.06721.82
7.0.90.0000.08321.71
7.0.80.0070.07721.70
7.0.70.0100.08021.96
7.0.60.0100.08021.75
7.0.50.0000.09022.06
7.0.40.0030.06719.95
7.0.30.0000.05020.11
7.0.20.0030.07720.19
7.0.10.0000.08720.14
7.0.00.0000.07320.12
5.6.280.0070.07021.06
5.6.250.0030.07720.51
5.6.240.0000.07720.57
5.6.230.0070.08320.64
5.6.220.0030.08020.69
5.6.210.0130.06320.59
5.6.200.0000.08021.07
5.6.190.0030.05721.06
5.6.180.0000.07321.16
5.6.170.0000.08021.04
5.6.160.0130.04720.98
5.6.150.0000.08021.03
5.6.140.0030.07721.06
5.6.130.0030.07020.91
5.6.120.0030.08320.95
5.6.110.0100.08321.08
5.6.100.0030.07721.18
5.6.90.0100.08021.02
5.6.80.0000.07720.41
5.6.70.0030.08020.57
5.6.60.0030.05720.40
5.6.50.0030.07720.31
5.6.40.0000.08720.49
5.6.30.0000.08720.33
5.6.20.0030.07720.48
5.6.10.0070.05020.33
5.6.00.0070.07720.42
5.5.380.0000.08320.37
5.5.370.0000.08720.59
5.5.360.0030.08320.41
5.5.350.0070.07720.41
5.5.340.0070.07720.95
5.5.330.0070.07720.82
5.5.320.0070.08020.95
5.5.310.0030.08020.82
5.5.300.0000.08720.85
5.5.290.0000.08720.91
5.5.280.0070.07720.93
5.5.270.0070.08320.90
5.5.260.0030.08020.77
5.5.250.0030.07720.74
5.5.240.0030.08320.18
5.5.230.0070.08020.17
5.5.220.0100.07720.16
5.5.210.0130.04020.13
5.5.200.0100.07020.30
5.5.190.0070.08020.24
5.5.180.0000.08320.11
5.5.160.0030.07720.20
5.5.150.0030.07320.11
5.5.140.0000.07720.29
5.5.130.0030.07720.20
5.5.120.0030.04720.24
5.5.110.0000.08020.29
5.5.100.0000.07320.14
5.5.90.0030.07720.02
5.5.80.0030.07320.09
5.5.70.0100.06720.09
5.5.60.0000.06020.08
5.5.50.0170.06320.08
5.5.40.0070.06320.17
5.5.30.0000.07320.02
5.5.20.0000.08320.11
5.5.10.0100.07719.98
5.5.00.0030.08020.09
5.4.450.0100.07019.38
5.4.440.0000.08719.42
5.4.430.0000.08019.57
5.4.420.0070.07019.40
5.4.410.0030.07019.43
5.4.400.0030.08019.05
5.4.390.0130.07018.85
5.4.380.0070.07319.18
5.4.370.0000.07719.05
5.4.360.0030.07019.14
5.4.350.0100.07319.17
5.4.340.0100.07319.13
5.4.320.0070.07319.03
5.4.310.0000.08019.05
5.4.300.0000.08019.14
5.4.290.0070.07719.06
5.4.280.0070.07319.21
5.4.270.0070.07019.03
5.4.260.0100.07318.87
5.4.250.0000.08318.90
5.4.240.0070.07018.82
5.4.230.0070.07318.88
5.4.220.0000.08319.04
5.4.210.0000.07719.20
5.4.200.0000.08019.04
5.4.190.0030.06318.94
5.4.180.0070.07019.11
5.4.170.0000.08319.04
5.4.160.0030.07719.16
5.4.150.0070.07019.02
5.4.140.0070.07016.43
5.4.130.0130.05716.35
5.4.120.0070.06316.42
5.4.110.0030.07316.57
5.4.100.0000.04716.42
5.4.90.0030.07316.45
5.4.80.0000.07016.49
5.4.70.0070.06016.37
5.4.60.0030.07316.43
5.4.50.0030.06716.34
5.4.40.0000.06316.36
5.4.30.0030.07016.30
5.4.20.0070.06016.39
5.4.10.0030.07016.48
5.4.00.0030.06315.85
5.3.290.0000.08014.68
5.3.280.0030.05314.54
5.3.270.0070.06714.61
5.3.260.0030.08014.43
5.3.250.0030.06714.48
5.3.240.0030.07314.55
5.3.230.0030.08014.60
5.3.220.0030.07014.56
5.3.210.0100.07314.55
5.3.200.0100.06314.53
5.3.190.0030.05714.54
5.3.180.0000.07714.43
5.3.170.0030.07714.43
5.3.160.0030.07314.43
5.3.150.0070.06014.54
5.3.140.0070.07014.55
5.3.130.0030.07714.54
5.3.120.0130.06714.54
5.3.110.0070.07014.54
5.3.100.0030.08014.05
5.3.90.0030.07314.01
5.3.80.0000.06713.95
5.3.70.0030.06714.00
5.3.60.0070.03013.87
5.3.50.0030.06713.93
5.3.40.0070.06013.80
5.3.30.0000.06013.85
5.3.20.0030.06013.55
5.3.10.0000.07313.66
5.3.00.0070.07013.55
5.2.170.0000.06311.09
5.2.160.0000.05011.16
5.2.150.0000.04311.09
5.2.140.0000.05711.10
5.2.130.0030.06010.95
5.2.120.0070.03010.91
5.2.110.0000.05711.14
5.2.100.0000.06311.05
5.2.90.0000.04011.09
5.2.80.0030.05711.02
5.2.70.0070.04311.12
5.2.60.0030.06311.04
5.2.50.0030.04711.01
5.2.40.0000.06010.86
5.2.30.0030.06310.83
5.2.20.0000.06310.98
5.2.10.0000.06710.91
5.2.00.0030.05710.74
5.1.60.0000.0539.82
5.1.50.0030.04310.00
5.1.40.0070.0239.97
5.1.30.0030.03310.19
5.1.20.0030.05310.36
5.1.10.0030.05010.12
5.1.00.0030.05310.12
5.0.50.0030.0438.61
5.0.40.0070.0378.46
5.0.30.0000.0608.41
5.0.20.0070.0408.41
5.0.10.0070.0408.41
5.0.00.0030.0608.41
4.4.90.0000.0338.41
4.4.80.0030.0338.41
4.4.70.0000.0378.41
4.4.60.0000.0208.41
4.4.50.0030.0378.41
4.4.40.0000.0578.41
4.4.30.0070.0238.41
4.4.20.0000.0238.41
4.4.10.0000.0338.41
4.4.00.0030.0508.41
4.3.110.0000.0378.41
4.3.100.0030.0338.41
4.3.90.0000.0338.41
4.3.80.0030.0538.41
4.3.70.0000.0378.41
4.3.60.0070.0308.41
4.3.50.0000.0378.41
4.3.40.0000.0478.41
4.3.30.0000.0378.41
4.3.20.0030.0338.41
4.3.10.0070.0278.41
4.3.00.0000.0308.41

preferences:
66.2 ms | 401 KiB | 5 Q