3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Translator1 { private $translator2; public function __construct(Translator2 $t2) { $this->translator2 = $t2; } } class Translator2 { private $translator3; public function __construct(Translator3 $t3) { $this->translator3 = $t3; } } class Translator3 extends ParentTranslator { // none found, look for 'x' in parent class } class ParentTranslator { private $x = 'LOL'; public function __construct() { $this->x = 'LOL'; } } function accessPrivatePropertyOf($object, ...$properties) { if (empty($properties)) { return $object; } $reflector = new \ReflectionClass($object); $property = array_shift($properties); echo 'Looking in: ' . (is_object($object) ? get_class($object) : gettype($object)) . ' for property: ' . $property . PHP_EOL; if (!$reflector->hasProperty($property)) { /** Try parent class **/ $parent = $reflector->getParentClass(); echo 'BUT... does not exist, looking in parent: ' . $object->getName() . ' instead...' . PHP_EOL; if (!$parent->hasProperty($property)) { throw new \Exception; } $prop = $parent->getProperty($property); $prop->setAccessible(true); $property = $prop->getValue($object); echo 'We found property with name: ' . $prop->getName() . ' and value: ' . $prop->getValue($object) . PHP_EOL; return accessPrivatePropertyOf($property, ...$properties); } $prop = $reflector->getProperty($property); $prop->setAccessible(true); $property = $prop->getValue($object); return accessPrivatePropertyOf($property, ...$properties); } $t = new Translator1(new Translator2(new Translator3)); // Shows no value for x WHYY?Y?? accessPrivatePropertyOf($t, 'translator2', 'translator3', 'x');

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.01018.43
8.3.50.0070.01122.97
8.3.40.0140.00419.09
8.3.30.0110.00418.78
8.3.20.0000.00820.14
8.3.10.0030.00518.76
8.3.00.0080.00020.61
8.2.180.0120.00918.45
8.2.170.0040.01122.96
8.2.160.0070.00720.45
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.01519.36
8.2.120.0040.00426.35
8.2.110.0070.00320.43
8.2.100.0090.00317.63
8.2.90.0000.00819.08
8.2.80.0030.00617.97
8.2.70.0040.00417.50
8.2.60.0000.00917.89
8.2.50.0030.00518.10
8.2.40.0000.00922.36
8.2.30.0090.00019.47
8.2.20.0000.00817.65
8.2.10.0050.00218.07
8.2.00.0030.00518.08
8.1.280.0120.00325.92
8.1.270.0090.00023.91
8.1.260.0030.00628.09
8.1.250.0040.00428.09
8.1.240.0060.00322.06
8.1.230.0040.00717.66
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0000.00917.36
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0060.00318.50
8.1.160.0000.00720.86
8.1.150.0000.00718.91
8.1.140.0040.00419.59
8.1.130.0000.00717.69
8.1.120.0040.00417.34
8.1.110.0040.00417.47
8.1.100.0060.00317.38
8.1.90.0040.00717.47
8.1.80.0040.00417.47
8.1.70.0000.00717.54
8.1.60.0050.00317.65
8.1.50.0050.00517.52
8.1.40.0000.00817.45
8.1.30.0040.00417.59
8.1.20.0040.00417.74
8.1.10.0040.00417.56
8.1.00.0000.00817.43
8.0.300.0110.00018.77
8.0.290.0030.00616.75
8.0.280.0030.00318.43
8.0.270.0030.00317.22
8.0.260.0030.00317.29
8.0.250.0040.00416.95
8.0.240.0030.00317.04
8.0.230.0030.00317.08
8.0.220.0030.00717.02
8.0.210.0040.00417.04
8.0.200.0050.00517.05
8.0.190.0030.00617.06
8.0.180.0000.00716.98
8.0.170.0000.00717.02
8.0.160.0000.00716.88
8.0.150.0040.00416.91
8.0.140.0030.00516.84
8.0.130.0030.00313.43
8.0.120.0000.00816.93
8.0.110.0040.00417.00
8.0.100.0000.00716.81
8.0.90.0040.00416.89
8.0.80.0120.00316.95
8.0.70.0030.00517.00
8.0.60.0040.00416.85
8.0.50.0080.00016.84
8.0.30.0100.00817.14
8.0.20.0100.00917.40
8.0.10.0000.00816.99
8.0.00.0120.00616.71
7.4.330.0000.00515.08
7.4.320.0070.00016.63
7.4.300.0060.00016.48
7.4.290.0000.00716.42
7.4.280.0070.00016.63
7.4.270.0030.00316.45
7.4.260.0000.00716.62
7.4.250.0000.00816.39
7.4.240.0040.00416.55
7.4.230.0080.00016.52
7.4.220.0030.01716.59
7.4.210.0110.00416.56
7.4.200.0020.00516.73
7.4.160.0120.00316.41
7.4.150.0170.00617.40
7.4.140.0060.01117.86
7.4.130.0140.00716.47
7.4.120.0050.01216.63
7.4.110.0090.00916.74
7.4.100.0160.00316.45
7.4.90.0080.01616.72
7.4.80.0110.00619.39
7.4.70.0060.01316.58
7.4.60.0060.01316.46
7.4.50.0040.00816.64
7.4.40.0060.00916.53
7.4.30.0130.00316.40
7.4.00.0030.00915.09
7.3.330.0040.00313.48
7.3.320.0000.00513.44
7.3.310.0040.00416.36
7.3.300.0070.00016.32
7.3.290.0020.01216.45
7.3.280.0100.00516.45
7.3.270.0130.00617.40
7.3.260.0090.00916.42
7.3.250.0150.00316.47
7.3.240.0100.01116.52
7.3.230.0030.01316.55
7.3.210.0030.01416.45
7.3.200.0170.00516.60
7.3.190.0090.00716.41
7.3.180.0030.01316.43
7.3.170.0170.00016.54
7.3.160.0100.00616.36
7.2.330.0120.00616.72
7.2.320.0140.00916.63
7.2.310.0090.00916.72
7.2.300.0090.00916.43
7.2.290.0130.00316.77
7.2.60.0030.01017.17
7.1.200.0070.00315.94
7.1.100.0110.00418.08
7.1.70.0000.00817.12
7.1.60.0070.01719.15
7.1.50.0100.00017.11
7.1.00.0070.07322.54
7.0.200.0030.00516.76
7.0.60.0270.07719.94
7.0.50.0030.04017.88
7.0.40.0270.06020.19
7.0.30.0370.04720.34
7.0.20.0230.05720.12
7.0.10.0370.06020.20
7.0.00.0430.04720.41
5.6.280.0130.06321.06
5.6.210.0070.08320.66
5.6.200.0100.04018.14
5.6.190.0270.07720.53
5.6.180.0400.04720.63
5.6.170.0400.06320.67
5.6.160.0200.05720.59
5.6.150.0200.06020.16
5.6.140.0270.05320.38
5.6.130.0300.06720.40
5.6.120.0300.06720.46
5.6.110.0070.06320.42
5.6.100.0500.05720.15
5.6.90.0770.07720.45
5.6.80.0170.06319.96
5.6.70.0770.06319.75
5.6.60.0870.07019.76
5.6.50.0730.05719.56
5.6.40.0670.06019.75
5.6.30.0730.05719.75
5.6.20.0700.06019.94
5.6.10.0800.06719.54
5.6.00.0900.05319.78
5.5.350.0270.07720.42
5.5.340.0130.07017.99
5.5.330.0200.06020.46
5.5.320.0130.06720.33
5.5.310.0230.05720.43
5.5.300.0170.07020.36
5.5.290.0230.06020.20
5.5.280.0100.08019.97
5.5.270.0270.04720.18
5.5.260.1070.07720.19
5.5.250.0670.06319.78
5.5.240.0030.06719.66
5.5.230.0770.06719.64
5.5.220.0900.06719.67
5.5.210.0970.05019.68
5.5.200.0700.05319.73
5.5.190.0830.05719.73
5.5.180.1030.04719.62
5.5.160.1030.04719.65
5.5.150.0830.05319.38
5.5.140.1100.04719.56
5.5.130.0870.06019.30
5.5.120.0800.06019.61
5.5.110.0670.06019.70
5.5.100.0870.06019.64
5.5.90.0900.05019.45
5.5.80.0930.05719.54
5.5.70.0770.07019.63
5.5.60.0770.06319.59
5.5.50.0770.05719.43
5.5.40.0730.05319.53
5.5.30.0870.05019.21
5.5.20.0730.05719.31
5.5.10.0800.06019.47
5.5.00.0700.06719.47

preferences:
58.55 ms | 401 KiB | 5 Q