3v4l.org

run code in 300+ PHP versions simultaneously
<?php class demo { public function MethodA() { return 'method A from class'; } public function MethodC() { return 'method C from class'; } public function MethodE() { return 'method E from class'; } use tGeneric; } trait tGeneric { public function MethodA() { return 'method A from trait'; } public function MethodB() { return 'method B from trait'; } public function MethodD() { return 'method D from trait'; } public function MethodE() { return 'method E from trait'; } } /** * Given a class name, retrieves the corresponding class' methods that override * trait methods. * * @param string $class_name * @return \ReflectionMethod[] * @throws \ReflectionException */ function getMethodsOverriddenFromTraits(string $class_name): array { $class = new \ReflectionClass($class_name); // Retrieve trait methods $trait_methods = []; foreach ($class->getTraits() as $trait) { foreach ($trait->getMethods() as $trait_method) { $trait_methods[$trait_method->getName()] = $trait_method; } } // Compute class methods that override them $methods_overridden = []; foreach ($class->getMethods() as $class_method) { if (array_key_exists($class_method->getName(), $trait_methods)) { $trait_method = $trait_methods[$class_method->getName()]; if ($class_method->getFileName() !== $trait_method->getFileName() || $class_method->getStartLine() !== $trait_method->getStartLine()) { $methods_overridden[] = $class_method->getName(); } } } return $methods_overridden; } print_r(getMethodsOverriddenFromTraits('demo'));

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.00.0140.00720.27
8.4.150.0010.00114.05
8.4.140.0090.01217.58
8.4.130.0120.00818.88
8.4.120.0090.00924.16
8.4.110.0070.01318.93
8.4.100.0090.00118.88
8.4.90.0140.00718.67
8.4.80.0110.01118.75
8.4.70.0060.00318.05
8.4.60.0110.00918.98
8.4.50.0110.00819.79
8.4.40.0040.01519.62
8.4.30.0200.00020.68
8.4.20.0100.00018.88
8.4.10.0090.00017.77
8.3.270.0120.00916.74
8.3.260.0040.00516.74
8.3.250.0150.00418.77
8.3.240.0120.00917.10
8.3.230.0140.00616.73
8.3.220.0110.00818.82
8.3.210.0070.01216.51
8.3.200.0100.00416.80
8.3.190.0160.00417.33
8.3.180.0060.01416.41
8.3.170.0070.01017.11
8.3.160.0140.00018.50
8.3.150.0070.01120.96
8.3.140.0100.01016.70
8.3.130.0100.00018.31
8.3.120.0100.01018.83
8.3.110.0000.00816.74
8.3.100.0030.01624.06
8.3.90.0040.00726.77
8.3.80.0000.01016.88
8.3.70.0040.01116.50
8.3.60.0060.00918.31
8.3.50.0050.01118.22
8.3.40.0070.00718.83
8.3.30.0100.00618.70
8.3.20.0090.00020.85
8.3.10.0080.00023.60
8.3.00.0050.00323.48
8.2.290.0070.00320.72
8.2.280.0090.00620.15
8.2.270.0180.00017.18
8.2.260.0150.00019.83
8.2.250.0030.01218.14
8.2.240.0070.00717.10
8.2.230.0040.00420.94
8.2.220.0080.00337.54
8.2.210.0100.01026.77
8.2.200.0090.00316.63
8.2.190.0140.00716.88
8.2.180.0100.01018.29
8.2.170.0040.01118.72
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0110.00424.66
8.2.130.0060.00319.83
8.2.120.0040.00426.35
8.2.110.0030.00621.13
8.2.100.0060.00619.63
8.2.90.0030.00617.97
8.2.80.0040.00417.97
8.2.70.0030.00517.93
8.2.60.0070.00318.28
8.2.50.0030.00618.10
8.2.40.0040.00419.47
8.2.30.0000.00719.22
8.2.20.0000.01018.20
8.2.10.0040.00419.40
8.2.00.0000.00819.13
8.1.330.0120.00721.88
8.1.320.0110.00817.90
8.1.310.0030.00616.61
8.1.300.0080.00018.14
8.1.290.0090.00330.84
8.1.280.0120.00925.92
8.1.270.0060.00918.96
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00323.91
8.1.230.0090.00322.66
8.1.220.0030.00617.79
8.1.210.0080.00019.04
8.1.200.0060.00317.25
8.1.190.0030.00517.23
8.1.180.0050.00518.10
8.1.170.0050.00318.59
8.1.160.0040.00418.83
8.1.150.0030.00718.86
8.1.140.0000.00722.23
8.1.130.0040.00420.18
8.1.120.0000.00817.48
8.1.110.0040.00417.48
8.1.100.0030.00717.51
8.1.90.0040.00417.40
8.1.80.0040.00417.54
8.1.70.0060.00317.55
8.1.60.0060.00317.68
8.1.50.0040.00417.56
8.1.40.0040.00417.61
8.1.30.0000.00817.63
8.1.20.0080.00017.52
8.1.10.0000.00817.62
8.1.00.0050.00217.56
8.0.300.0050.00319.55
8.0.290.0000.00816.63
8.0.280.0000.00718.47
8.0.270.0040.00417.92
8.0.260.0030.00318.40
8.0.250.0070.00016.91
8.0.240.0000.00716.95
8.0.230.0000.00716.89
8.0.220.0000.00816.76
8.0.210.0070.00016.94
8.0.200.0040.00416.82
8.0.190.0000.00817.02
8.0.180.0030.00516.91
8.0.170.0000.00916.82
8.0.160.0050.00517.02
8.0.150.0050.00216.89
8.0.140.0000.00716.90
8.0.130.0060.00313.39
8.0.120.0070.00016.88
8.0.110.0040.00416.89
8.0.100.0070.00017.04
8.0.90.0000.00816.81
8.0.80.0110.00516.89
8.0.70.0070.00016.80
8.0.60.0000.00716.88
8.0.50.0070.00016.90
8.0.30.0130.00417.19
8.0.20.0100.01017.46
8.0.10.0040.00416.95
8.0.00.0070.01016.67
7.4.330.0030.00315.55
7.4.320.0000.00616.48
7.4.300.0030.00316.58
7.4.290.0040.00416.66
7.4.280.0090.00016.48
7.4.270.0000.00716.64
7.4.260.0030.00316.61
7.4.250.0040.00416.40
7.4.240.0070.00016.70
7.4.230.0040.00416.59
7.4.220.0040.00416.61
7.4.210.0100.00616.55
7.4.200.0000.00716.74
7.4.160.0080.00916.56
7.4.140.0090.01317.86
7.4.130.0110.00616.52
7.4.120.0120.01416.40
7.4.110.0130.01016.35
7.4.100.0120.00916.63
7.4.90.0100.00616.50
7.4.80.0120.00619.39
7.4.70.0070.01016.59
7.4.60.0090.00616.57
7.4.50.0100.00716.20
7.4.40.0040.01216.37
7.4.00.0140.00014.70
7.3.330.0050.00013.20
7.3.320.0030.00313.23
7.3.310.0050.00216.27
7.3.300.0030.00316.33
7.3.290.0040.00316.22
7.3.280.0040.01216.28
7.3.260.0110.00916.49
7.3.240.0120.00616.54
7.3.230.0130.00316.57
7.3.210.0130.00616.44
7.3.200.0130.00316.33
7.3.190.0150.00316.45
7.3.180.0130.00316.48
7.3.170.0070.01116.33
7.3.160.0130.00516.65
7.3.120.0060.01214.93
7.3.110.0110.00414.82
7.3.100.0060.01114.66
7.3.90.0080.00614.73
7.3.80.0070.01014.88
7.3.70.0030.01014.61
7.3.60.0030.00914.92
7.3.50.0040.00714.98
7.3.40.0000.01114.90
7.3.30.0060.00914.63
7.3.20.0030.01316.46
7.3.10.0050.00716.63
7.3.00.0170.00616.23
7.2.330.0060.01316.89
7.2.320.0100.00716.82
7.2.310.0070.01016.65
7.2.300.0060.01016.87
7.2.290.0070.01016.71
7.2.240.0030.01015.19
7.2.230.0060.01015.06
7.2.220.0030.00714.75
7.2.210.0000.01514.97
7.2.200.0030.01015.11
7.2.190.0000.01415.16
7.2.180.0060.00914.98
7.2.170.0090.00615.17
7.2.160.0100.00315.13
7.2.150.0070.01016.78
7.2.140.0030.01016.82
7.2.130.0330.00616.45
7.2.120.0170.01116.38
7.2.110.0190.00816.50
7.2.100.0180.00916.54
7.2.90.0170.00716.48
7.2.80.0140.00916.54
7.2.70.0190.00616.51
7.2.60.0140.00716.42
7.2.50.0130.00816.59
7.2.40.0150.00616.50
7.2.30.0150.00916.46
7.2.20.0120.00916.38
7.2.10.0110.00716.56
7.2.00.0120.00816.52
7.1.330.0080.00816.05
7.1.320.0060.00615.61
7.1.310.0000.01715.98
7.1.300.0070.00315.84
7.1.290.0030.01015.66
7.1.280.0030.01415.84
7.1.270.0070.00315.88
7.1.260.0030.00915.70
7.1.250.0150.00615.34
7.0.330.0540.00613.70
5.6.380.0080.00813.98

preferences:
41.42 ms | 403 KiB | 5 Q