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?? var_dump(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.0140.00718.43
8.3.50.0060.01322.92
8.3.40.0070.00718.83
8.3.30.0070.00718.88
8.3.20.0080.00020.33
8.3.10.0080.00018.86
8.3.00.0000.00820.63
8.2.180.0140.00716.50
8.2.170.0110.00422.96
8.2.160.0070.01320.39
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0040.00419.48
8.2.120.0040.00426.35
8.2.110.0070.00320.39
8.2.100.0110.00017.66
8.2.90.0040.00419.25
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0050.00317.79
8.2.50.0040.00418.10
8.2.40.0000.00922.26
8.2.30.0030.00619.40
8.2.20.0080.00017.81
8.2.10.0060.00318.02
8.2.00.0040.00417.97
8.1.280.0000.01425.92
8.1.270.0040.00423.79
8.1.260.0090.00028.09
8.1.250.0000.00828.09
8.1.240.0070.00322.20
8.1.230.0090.00320.91
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.36
8.1.190.0050.00317.35
8.1.180.0030.00518.10
8.1.170.0060.00618.46
8.1.160.0000.00720.95
8.1.150.0030.00518.91
8.1.140.0000.00719.61
8.1.130.0040.00417.73
8.1.120.0040.00317.49
8.1.110.0040.00417.55
8.1.100.0040.00417.32
8.1.90.0090.00017.45
8.1.80.0040.00417.41
8.1.70.0000.00717.42
8.1.60.0040.00417.58
8.1.50.0000.00817.55
8.1.40.0040.00417.55
8.1.30.0000.00817.67
8.1.20.0040.00417.75
8.1.10.0080.00017.59
8.1.00.0040.00417.43
8.0.300.0030.00618.77
8.0.290.0080.00016.75
8.0.280.0040.00418.52
8.0.270.0030.00317.28
8.0.260.0000.00717.35
8.0.250.0030.00316.96
8.0.240.0000.00716.96
8.0.230.0000.00717.04
8.0.220.0060.00317.02
8.0.210.0030.00616.99
8.0.200.0070.00317.01
8.0.190.0000.00916.98
8.0.180.0050.00217.00
8.0.170.0000.00916.98
8.0.160.0080.00016.98
8.0.150.0040.00416.95
8.0.140.0050.00316.82
8.0.130.0030.00313.48
8.0.120.0080.00017.00
8.0.110.0070.00016.94
8.0.100.0060.00316.86
8.0.90.0070.00016.98
8.0.80.0100.00717.01
8.0.70.0040.00416.81
8.0.60.0040.00416.97
8.0.50.0050.00316.89
8.0.30.0070.01017.18
8.0.20.0130.00917.40
8.0.10.0040.00417.05
8.0.00.0100.00816.95
7.4.330.0000.00515.08
7.4.320.0040.00416.53
7.4.300.0060.00016.67
7.4.290.0000.00716.52
7.4.280.0000.00716.64
7.4.270.0040.00416.62
7.4.260.0000.00716.62
7.4.250.0040.00416.57
7.4.240.0070.00016.53
7.4.230.0030.00316.33
7.4.220.0060.01316.64
7.4.210.0070.00716.66
7.4.200.0000.00716.66
7.4.160.0110.00416.55
7.4.150.0070.01317.40
7.4.140.0060.01217.86
7.4.130.0060.01416.53
7.4.120.0070.01216.67
7.4.110.0180.00016.59
7.4.100.0110.01116.70
7.4.90.0100.00716.61
7.4.80.0140.00319.39
7.4.70.0120.00616.49
7.4.60.0120.00416.61
7.4.50.0000.01216.72
7.4.40.0110.00816.59
7.4.30.0100.01016.60
7.4.00.0060.01015.01
7.3.330.0060.00013.32
7.3.320.0060.00013.32
7.3.310.0040.00416.50
7.3.300.0030.00616.41
7.3.290.0090.00716.40
7.3.280.0060.01016.43
7.3.270.0090.00917.40
7.3.260.0140.00316.37
7.3.250.0120.00616.40
7.3.240.0070.01016.66
7.3.230.0090.00916.48
7.3.210.0100.01016.40
7.3.200.0080.00816.48
7.3.190.0080.00816.55
7.3.180.0120.00316.62
7.3.170.0030.01516.58
7.3.160.0070.01016.44
7.3.120.0030.01515.18
7.3.110.0060.01314.92
7.3.100.0030.01514.68
7.3.90.0080.00315.07
7.3.80.0030.00614.98
7.3.70.0070.00714.68
7.3.60.0110.00014.82
7.3.50.0100.00315.05
7.3.40.0050.00314.92
7.3.30.0070.00714.97
7.3.20.0030.01016.62
7.3.10.0070.00716.50
7.3.00.0000.01116.80
7.2.330.0130.00316.52
7.2.320.0030.01916.80
7.2.310.0090.01216.88
7.2.300.0060.01216.50
7.2.290.0060.01016.53
7.2.250.0100.01015.30
7.2.240.0030.01715.09
7.2.230.0120.00315.30
7.2.220.0040.01114.98
7.2.210.0070.01114.88
7.2.200.0100.00315.01
7.2.190.0070.00715.06
7.2.180.0120.00415.18
7.2.170.0040.00414.82
7.2.160.0030.00614.90
7.2.150.0000.01016.83
7.2.140.0030.01217.04
7.2.130.0030.00716.90
7.2.120.0090.00616.80
7.2.110.0000.01416.76
7.2.100.0080.00817.06
7.2.90.0090.00317.00
7.2.80.0060.00916.98
7.2.70.0030.01617.10
7.2.60.0070.01117.11
7.2.50.0070.01116.86
7.2.40.0080.00616.86
7.2.30.0060.00916.94
7.2.20.0030.00617.15
7.2.10.0050.00716.78
7.2.00.0030.00918.29
7.1.330.0080.00615.65
7.1.320.0030.00915.64
7.1.310.0030.01015.87
7.1.300.0040.01115.60
7.1.290.0060.00615.51
7.1.280.0050.00516.00
7.1.270.0050.00315.80
7.1.260.0030.01115.54
7.1.250.0000.01115.71
7.1.240.0040.00415.65
7.1.230.0130.00315.50
7.1.220.0120.00615.86
7.1.210.0070.00415.50
7.1.200.0030.00715.69
7.1.190.0040.01415.71
7.1.180.0070.01015.83
7.1.170.0070.00715.83
7.1.160.0040.00815.73
7.1.150.0030.01015.70
7.1.140.0100.00316.01
7.1.130.0060.00615.53
7.1.120.0070.00715.73
7.1.110.0040.01115.70
7.1.100.0000.01115.78
7.1.90.0060.01015.88
7.1.80.0070.00415.91
7.1.70.0030.00916.58
7.1.60.0050.00816.45
7.1.50.0050.01216.43
7.1.40.0060.00915.45
7.1.30.0030.01015.51
7.1.20.0070.01015.70
7.1.10.0030.00715.87
7.1.00.0050.04118.95
7.0.330.0030.00615.14
7.0.320.0060.00915.46
7.0.310.0060.00715.56
7.0.300.0070.01015.46
7.0.290.0080.00415.43
7.0.280.0030.00915.15
7.0.270.0040.00415.42
7.0.260.0000.01215.53
7.0.250.0060.00615.59
7.0.240.0030.00915.64
7.0.230.0060.00615.34
7.0.220.0050.00515.56
7.0.210.0100.00615.51
7.0.200.0030.00916.01
7.0.190.0070.00715.15
7.0.180.0100.00315.48
7.0.170.0040.00815.59
7.0.160.0070.00315.35
7.0.150.0050.00515.57
7.0.140.0030.00715.25
7.0.130.0100.00615.36
7.0.120.0000.01415.56
7.0.110.0000.01415.25
7.0.100.0060.00915.52
7.0.90.0000.01215.54
7.0.80.0060.00315.13
7.0.70.0040.01115.49
7.0.60.0150.03817.60
7.0.50.0030.02516.74
7.0.40.0330.03016.88
7.0.30.0170.03316.77
7.0.20.0150.04616.86
7.0.10.0180.03316.69
7.0.00.0150.03316.88
5.6.400.0030.01014.54
5.6.390.0070.00314.38
5.6.380.0040.01114.40
5.6.370.0100.00714.36
5.6.360.0040.00414.55
5.6.350.0070.00714.34
5.6.340.0060.00614.61
5.6.330.0030.01014.36
5.6.320.0030.01014.09
5.6.310.0040.00814.27
5.6.300.0040.00814.32
5.6.290.0050.00514.65
5.6.280.0040.04217.86
5.6.270.0000.01514.36
5.6.260.0060.01014.37
5.6.250.0040.00914.65
5.6.240.0080.00414.70
5.6.230.0030.01014.23
5.6.220.0070.00714.51
5.6.210.0100.04017.48
5.6.200.0100.03816.20
5.6.190.0120.03317.59
5.6.180.0230.04217.32
5.6.170.0150.03117.41
5.6.160.0210.03017.58
5.6.150.0100.03917.29
5.6.140.0150.03317.31
5.6.130.0200.03717.46
5.6.120.0120.03917.36
5.6.110.0050.03917.55
5.6.100.0130.04417.39
5.6.90.0120.03317.21
5.6.80.0210.02517.08
5.6.70.0180.02817.05
5.6.60.0160.02817.11
5.6.50.0140.03216.94
5.6.40.0100.03517.09
5.6.30.0140.03317.02
5.6.20.0180.03616.81
5.6.10.0110.03617.08
5.6.00.0080.03616.85
5.5.380.0060.00614.03
5.5.370.0000.00914.34
5.5.360.0120.00313.84
5.5.350.0150.04217.16
5.5.340.0080.03916.05
5.5.330.0030.03917.28
5.5.320.0080.03617.10
5.5.310.0120.03517.16
5.5.300.0100.04017.01
5.5.290.0110.04217.11
5.5.280.0120.03217.19
5.5.270.0030.04317.10
5.5.260.0200.03217.19
5.5.250.0150.03516.92
5.5.240.0140.03616.86
5.5.230.0190.03116.77
5.5.220.0140.03516.64
5.5.210.0130.03316.54
5.5.200.0100.03516.84
5.5.190.0200.02816.74
5.5.180.0080.04116.90
5.5.170.0070.00713.88
5.5.160.0120.03216.79
5.5.150.0080.04516.73
5.5.140.0170.03516.74
5.5.130.0170.03216.55
5.5.120.0140.03216.61
5.5.110.0180.04016.90
5.5.100.0140.03216.66
5.5.90.0120.03516.54
5.5.80.0190.02916.61
5.5.70.0180.03216.55
5.5.60.0120.03416.50
5.5.50.0170.02816.78
5.5.40.0180.02516.78
5.5.30.0100.03616.72
5.5.20.0130.03216.59
5.5.10.0140.04116.34
5.5.00.0120.03516.75

preferences:
32.95 ms | 401 KiB | 5 Q