3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $public_parent; protected $protected_parent; private $private_parent; public function whoami() { echo PHP_EOL, __METHOD__, PHP_EOL; echo 'self::class: ', self::class, PHP_EOL; echo 'static::class: ', static::class, PHP_EOL; echo 'property public_parent exists ? ', var_export(property_exists(static::class, 'public_parent'), true), PHP_EOL; echo 'property protected_parent exists ? ', var_export(property_exists(static::class, 'protected_parent'), true), PHP_EOL; echo 'property private_parent exists ? ', var_export(property_exists(static::class, 'private_parent'), true), PHP_EOL; echo 'property public_child exists ? ', var_export(property_exists(static::class, 'public_child'), true), PHP_EOL; echo 'property protected_child exists ? ', var_export(property_exists(static::class, 'protected_child'), true), PHP_EOL; echo 'property private_child exists ? ', var_export(property_exists(static::class, 'private_child'), true), PHP_EOL; echo 'property public_grandchild exists ? ', var_export(property_exists(static::class, 'public_grandchild'), true), PHP_EOL; echo 'property protected_grandchild exists ? ', var_export(property_exists(static::class, 'protected_grandchild'), true), PHP_EOL; echo 'property private_grandchild exists ? ', var_export(property_exists(static::class, 'private_grandchild'), true), PHP_EOL; } } class Foo_Child extends Foo { public $public_child; protected $protected_child; private $private_child; public function whoami() { echo PHP_EOL, __METHOD__, PHP_EOL; echo 'self::class: ', self::class, PHP_EOL; echo 'static::class: ', static::class, PHP_EOL; echo 'property public_parent exists ? ', var_export(property_exists(static::class, 'public_parent'), true), PHP_EOL; echo 'property protected_parent exists ? ', var_export(property_exists(static::class, 'protected_parent'), true), PHP_EOL; echo 'property private_parent exists ? ', var_export(property_exists(static::class, 'private_parent'), true), PHP_EOL; echo 'property public_child exists ? ', var_export(property_exists(static::class, 'public_child'), true), PHP_EOL; echo 'property protected_child exists ? ', var_export(property_exists(static::class, 'protected_child'), true), PHP_EOL; echo 'property private_child exists ? ', var_export(property_exists(static::class, 'private_child'), true), PHP_EOL; echo 'property public_grandchild exists ? ', var_export(property_exists(static::class, 'public_grandchild'), true), PHP_EOL; echo 'property protected_grandchild exists ? ', var_export(property_exists(static::class, 'protected_grandchild'), true), PHP_EOL; echo 'property private_grandchild exists ? ', var_export(property_exists(static::class, 'private_grandchild'), true), PHP_EOL; parent::whoami(); } } class Foo_GrandChild extends Foo_Child { public $public_grandchild; protected $protected_grandchild; private $private_grandchild; public function whoami() { echo PHP_EOL, __METHOD__, PHP_EOL; echo 'self::class: ', self::class, PHP_EOL; echo 'static::class: ', static::class, PHP_EOL; echo 'property public_parent exists ? ', var_export(property_exists(static::class, 'public_parent'), true), PHP_EOL; echo 'property protected_parent exists ? ', var_export(property_exists(static::class, 'protected_parent'), true), PHP_EOL; echo 'property private_parent exists ? ', var_export(property_exists(static::class, 'private_parent'), true), PHP_EOL; echo 'property public_child exists ? ', var_export(property_exists(static::class, 'public_child'), true), PHP_EOL; echo 'property protected_child exists ? ', var_export(property_exists(static::class, 'protected_child'), true), PHP_EOL; echo 'property private_child exists ? ', var_export(property_exists(static::class, 'private_child'), true), PHP_EOL; echo 'property public_grandchild exists ? ', var_export(property_exists(static::class, 'public_grandchild'), true), PHP_EOL; echo 'property protected_grandchild exists ? ', var_export(property_exists(static::class, 'protected_grandchild'), true), PHP_EOL; echo 'property private_grandchild exists ? ', var_export(property_exists(static::class, 'private_grandchild'), true), PHP_EOL; parent::whoami(); } } echo '==== GRANDCHILD OUTSIDE ====', PHP_EOL; $foo_grandchild = new Foo_GrandChild; echo 'property public_parent exists ? ', var_export(property_exists($foo_grandchild, 'public_parent'), true), PHP_EOL; echo 'property protected_parent exists ? ', var_export(property_exists($foo_grandchild, 'protected_parent'), true), PHP_EOL; echo 'property private_parent exists ? ', var_export(property_exists($foo_grandchild, 'private_parent'), true), PHP_EOL; echo 'property public_child exists ? ', var_export(property_exists($foo_grandchild, 'public_child'), true), PHP_EOL; echo 'property protected_child exists ? ', var_export(property_exists($foo_grandchild, 'protected_child'), true), PHP_EOL; echo 'property private_child exists ? ', var_export(property_exists($foo_grandchild, 'private_child'), true), PHP_EOL; echo 'property public_grandchild exists ? ', var_export(property_exists($foo_grandchild, 'public_grandchild'), true), PHP_EOL; echo 'property protected_grandchild exists ? ', var_export(property_exists($foo_grandchild, 'protected_grandchild'), true), PHP_EOL; echo 'property private_grandchild exists ? ', var_export(property_exists($foo_grandchild, 'private_grandchild'), true), PHP_EOL; echo PHP_EOL, '==== INSIDE GRANDCHILD ====', PHP_EOL; $foo_grandchild->whoami(); echo PHP_EOL, '==== CHILD OUTSIDE ====', PHP_EOL; $foo_child = new Foo_Child; echo 'property public_parent exists ? ', var_export(property_exists($foo_child, 'public_parent'), true), PHP_EOL; echo 'property protected_parent exists ? ', var_export(property_exists($foo_child, 'protected_parent'), true), PHP_EOL; echo 'property private_parent exists ? ', var_export(property_exists($foo_child, 'private_parent'), true), PHP_EOL; echo 'property public_child exists ? ', var_export(property_exists($foo_child, 'public_child'), true), PHP_EOL; echo 'property protected_child exists ? ', var_export(property_exists($foo_child, 'protected_child'), true), PHP_EOL; echo 'property private_child exists ? ', var_export(property_exists($foo_child, 'private_child'), true), PHP_EOL; echo 'property public_grandchild exists ? ', var_export(property_exists($foo_child, 'public_grandchild'), true), PHP_EOL; echo 'property protected_grandchild exists ? ', var_export(property_exists($foo_child, 'protected_grandchild'), true), PHP_EOL; echo 'property private_grandchild exists ? ', var_export(property_exists($foo_child, 'private_grandchild'), true), PHP_EOL; echo PHP_EOL, '==== INSIDE CHILD ====', PHP_EOL; $foo_child->whoami(); echo PHP_EOL, '==== PARENT OUTSIDE ====', PHP_EOL; $foo = new Foo; echo 'property public_parent exists ? ', var_export(property_exists($foo, 'public_parent'), true), PHP_EOL; echo 'property protected_parent exists ? ', var_export(property_exists($foo, 'protected_parent'), true), PHP_EOL; echo 'property private_parent exists ? ', var_export(property_exists($foo, 'private_parent'), true), PHP_EOL; echo 'property public_child exists ? ', var_export(property_exists($foo, 'public_child'), true), PHP_EOL; echo 'property protected_child exists ? ', var_export(property_exists($foo, 'protected_child'), true), PHP_EOL; echo 'property private_child exists ? ', var_export(property_exists($foo, 'private_child'), true), PHP_EOL; echo 'property public_grandchild exists ? ', var_export(property_exists($foo, 'public_grandchild'), true), PHP_EOL; echo 'property protected_grandchild exists ? ', var_export(property_exists($foo, 'protected_grandchild'), true), PHP_EOL; echo 'property private_grandchild exists ? ', var_export(property_exists($foo, 'private_grandchild'), true), PHP_EOL; echo PHP_EOL, '==== INSIDE PARENT ====', PHP_EOL; $foo->whoami();

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.1.130.0050.00219.08
8.1.120.0000.00717.45
8.1.110.0040.00417.51
8.1.100.0000.00917.54
8.1.90.0110.00217.56
8.1.80.0110.00617.50
8.1.70.0110.00617.48
8.1.60.0160.00317.70
8.1.50.0150.00517.67
8.1.40.0130.00517.60
8.1.30.0190.00017.76
8.1.20.0110.01017.72
8.1.10.0130.00617.69
8.1.00.0130.00617.68
8.0.260.0000.00718.59
8.0.250.0030.00417.13
8.0.240.0070.00017.12
8.0.230.0000.00716.95
8.0.220.0130.00517.02
8.0.210.0130.00316.97
8.0.200.0140.00216.99
8.0.190.0110.00616.99
8.0.180.0100.00616.95
8.0.170.0120.00416.97
8.0.160.0130.00317.00
8.0.150.0100.00616.88
8.0.140.0090.00716.88
8.0.130.0100.00616.86
8.0.120.0100.00616.92
8.0.110.0090.00516.88
8.0.100.0110.00516.96
8.0.90.0100.00716.89
8.0.80.0110.00516.90
8.0.70.0110.00516.94
8.0.60.0130.00216.82
8.0.50.0110.00416.90
8.0.30.0110.00516.85
8.0.20.0180.00016.95
8.0.10.0090.00717.06
8.0.00.0140.00317.03
7.4.330.0060.00015.55
7.4.320.0030.00316.46
7.4.300.0100.00816.64
7.4.290.0120.00616.66
7.4.280.0130.00416.64
7.4.270.0160.00216.70
7.4.260.0120.00416.67
7.4.250.0130.00416.51
7.4.240.0120.00316.59
7.4.230.0130.00216.65
7.4.220.0070.00716.70
7.4.210.0140.00216.63
7.4.200.0040.01116.74
7.4.190.0060.00916.78
7.4.180.0110.00316.69
7.4.160.0090.00616.71
7.4.150.0130.00216.57
7.4.140.0110.00416.51
7.4.130.0120.00316.62
7.4.120.0110.00416.65
7.4.110.0090.00616.50
7.4.100.0090.00716.66
7.4.90.0120.00316.61
7.4.80.0100.00416.71
7.4.70.0130.00216.54
7.4.60.0130.00316.59
7.4.50.0140.00216.54
7.4.40.0150.00016.50
7.4.30.0070.00716.62
7.4.20.0100.00516.53
7.4.10.0090.00516.53
7.4.00.0120.00316.51
7.3.330.0150.00016.30
7.3.320.0080.00816.27
7.3.310.0100.00616.43
7.3.300.0120.00316.22
7.3.290.0130.00316.41
7.3.280.0130.00216.41
7.3.270.0110.00416.41
7.3.260.0120.00316.45
7.3.250.0110.00416.34
7.3.240.0120.00216.36
7.3.230.0080.00816.39
7.3.220.0080.00716.36
7.3.210.0130.00316.37
7.3.200.0100.00516.30
7.3.190.0070.00716.13
7.3.180.0090.00616.30
7.3.170.0110.00416.09
7.3.160.0130.00316.11
7.3.150.0120.00316.16
7.3.140.0120.00316.33
7.3.130.0080.00816.38
7.3.120.0090.00516.29
7.3.110.0080.00816.06
7.3.100.0050.01016.12
7.3.90.0120.00416.58
7.3.80.0100.00516.17
7.3.70.0100.00516.34
7.3.60.0070.00716.49
7.3.50.0110.00416.60
7.3.40.0100.00516.39
7.3.30.0070.00716.38
7.3.20.0120.00318.08
7.3.10.0120.00417.94
7.3.00.0160.00018.09
7.2.340.0090.00716.41
7.2.330.0070.00716.46
7.2.320.0000.01416.40
7.2.310.0110.00416.41
7.2.300.0100.00516.41
7.2.290.0100.00516.29
7.2.280.0110.00416.32
7.2.270.0150.00016.30
7.2.260.0100.00516.42
7.2.250.0150.00016.36
7.2.240.0090.00616.47
7.2.230.0130.00316.46
7.2.220.0120.00216.54
7.2.210.0120.00216.46
7.2.200.0080.00816.48
7.2.190.0120.00316.55
7.2.180.0120.00316.62
7.2.170.0060.00916.66
7.2.160.0100.00516.65
7.2.150.0100.00618.31
7.2.140.0000.01518.38
7.2.130.0050.01018.44
7.2.120.0160.00318.38
7.2.110.0160.00018.46
7.2.100.0100.00518.56
7.2.90.0150.00318.44
7.2.80.0190.00018.29
7.2.70.0110.00518.24
7.2.60.0060.00918.43
7.2.50.0100.00518.33
7.2.40.0130.00418.38
7.2.30.0130.00318.28
7.2.20.0120.00618.50
7.2.10.0170.00018.44
7.2.00.0120.00418.47
7.1.330.0080.00717.36
7.1.320.0120.00317.48
7.1.310.0120.00317.22
7.1.300.0110.00417.13
7.1.290.0100.00517.26
7.1.280.0090.00617.33
7.1.270.0140.00017.16
7.1.260.0100.00517.32
7.1.250.0120.00317.08
7.1.240.0150.00017.23
7.1.230.0100.00417.31
7.1.220.0160.00017.31
7.1.210.0080.00917.36
7.1.200.0100.00517.27
7.1.190.0130.00317.33
7.1.180.0120.00317.24
7.1.170.0150.00017.16
7.1.160.0120.00317.36
7.1.150.0150.00017.25
7.1.140.0110.00517.26
7.1.130.0070.00717.04
7.1.120.0120.00317.08
7.1.110.0090.00617.21
7.1.100.0060.00917.29
7.1.90.0080.00817.29
7.1.80.0050.01017.38
7.1.70.0150.00017.20
7.1.60.0150.00017.32
7.1.50.0130.00317.29
7.1.40.0120.00317.33
7.1.30.0110.00517.48
7.1.20.0040.01217.25
7.1.10.0080.00817.12
7.1.00.0130.00217.18
7.0.330.0100.00517.02
7.0.320.0110.00417.05
7.0.310.0100.00516.96
7.0.300.0100.00516.95
7.0.290.0130.00016.91
7.0.280.0080.00816.98
7.0.270.0100.00517.06
7.0.260.0120.00317.03
7.0.250.0110.00417.05
7.0.240.0090.00517.19
7.0.230.0180.00017.04
7.0.220.0120.00517.12
7.0.210.0100.00517.05
7.0.200.0160.00017.00
7.0.190.0170.00316.98
7.0.180.0100.00716.84
7.0.170.0170.00017.19
7.0.160.0170.00016.94
7.0.150.0130.00317.02
7.0.140.0060.00917.01
7.0.130.0110.00417.12
7.0.120.0140.00316.97
7.0.110.0110.00717.04
7.0.100.0100.00516.89
7.0.90.0150.00016.90
7.0.80.0090.00616.99
7.0.70.0070.00716.86
7.0.60.0040.01116.83
7.0.50.0100.00716.92
7.0.40.0120.00417.09
7.0.30.0110.00416.97
7.0.20.0080.00516.81
7.0.10.0110.00417.06
7.0.00.0110.00316.89
5.6.400.0000.01315.79
5.6.390.0120.00315.83
5.6.380.0130.00215.81
5.6.370.0140.00015.87
5.6.360.0120.00215.73
5.6.350.0090.00615.87
5.6.340.0040.00915.89
5.6.330.0070.00715.93
5.6.320.0140.00016.00
5.6.310.0090.00515.93
5.6.300.0080.00515.53
5.6.290.0130.00015.81
5.6.280.0100.00315.86
5.6.270.0100.00316.01
5.6.260.0070.00715.79
5.6.250.0100.00315.73
5.6.240.0070.00715.87
5.6.230.0040.00816.05
5.6.220.0130.00015.83
5.6.210.0070.00716.00
5.6.200.0100.00316.09
5.6.190.0140.00015.96
5.6.180.0130.00015.82
5.6.170.0130.00016.09
5.6.160.0080.00515.84
5.6.150.0100.00315.88
5.6.140.0030.01015.78
5.6.130.0040.00815.77
5.6.120.0090.00416.00
5.6.110.0090.00415.71
5.6.100.0110.00215.93
5.6.90.0130.00015.96
5.6.80.0000.01415.92
5.6.70.0100.00516.09
5.6.60.0120.00315.95
5.6.50.0110.00415.98
5.6.40.0070.00715.87
5.6.30.0100.00315.84
5.6.20.0040.00815.68
5.6.10.0040.00915.68
5.6.00.0090.00515.81
5.5.380.0040.00915.93
5.5.370.0080.00516.04
5.5.360.0130.00015.56
5.5.350.0030.01015.70
5.5.340.0100.00315.83
5.5.330.0070.00715.93
5.5.320.0120.00015.93
5.5.310.0130.00015.72
5.5.300.0090.00415.72
5.5.290.0090.00415.79
5.5.280.0130.00015.77
5.5.270.0110.00215.94
5.5.260.0100.00315.77
5.5.250.0000.01516.00
5.5.240.0080.00615.89
5.5.230.0100.00515.73
5.5.220.0070.00715.66
5.5.210.0070.00715.76
5.5.200.0070.00715.66
5.5.190.0100.00315.56
5.5.180.0070.00715.50
5.5.170.0090.00415.55
5.5.160.0000.01415.64
5.5.150.0060.00615.58
5.5.140.0110.00315.74
5.5.130.0130.00015.71
5.5.120.0110.00315.59
5.5.110.0080.00615.63
5.5.100.0040.00915.94
5.5.90.0030.00915.79
5.5.80.0090.00415.77
5.5.70.0100.00315.78
5.5.60.0100.00315.90
5.5.50.0100.00315.64
5.5.40.0110.00216.00
5.5.30.0090.00315.68
5.5.20.0090.00215.98
5.5.10.0060.00715.90
5.5.00.0120.00015.66
5.4.450.0050.00512.50
5.4.440.0100.00012.57
5.4.430.0000.01012.41
5.4.420.0070.00312.27
5.4.410.0090.00012.53
5.4.400.0030.00712.37
5.4.390.0050.00512.37
5.4.380.0070.00212.22
5.4.370.0100.00012.36
5.4.360.0070.00412.35
5.4.350.0000.01012.38
5.4.340.0100.00012.53
5.4.330.0100.00012.45
5.4.320.0070.00312.50
5.4.310.0060.00612.20
5.4.300.0050.00512.59
5.4.290.0050.00512.41
5.4.280.0050.00512.53
5.4.270.0080.00312.42
5.4.260.0110.00012.44
5.4.250.0110.00012.37
5.4.240.0070.00312.43
5.4.230.0110.00012.20
5.4.220.0070.00412.19
5.4.210.0070.00412.19
5.4.200.0090.00212.19
5.4.190.0000.01112.16
5.4.180.0130.00012.33
5.4.170.0040.00812.03
5.4.160.0050.00512.39
5.4.150.0100.00012.36
5.4.140.0090.00012.51
5.4.130.0080.00212.37
5.4.120.0060.00312.43
5.4.110.0070.00412.26
5.4.100.0070.00312.21
5.4.90.0090.00012.40
5.4.80.0090.00012.59
5.4.70.0060.00412.49
5.4.60.0070.00312.55
5.4.50.0100.00012.20
5.4.40.0060.00412.20
5.4.30.0070.00312.40
5.4.20.0040.00712.18
5.4.10.0000.01012.50
5.4.00.0060.00312.13
5.3.290.0110.00012.68
5.3.280.0100.00012.56
5.3.270.0030.00712.62
5.3.260.0100.00012.67
5.3.250.0100.00012.63
5.3.240.0050.00512.49
5.3.230.0100.00012.77
5.3.220.0030.00712.57
5.3.210.0070.00312.57
5.3.200.0080.00412.78
5.3.190.0120.00012.84
5.3.180.0070.00312.96
5.3.170.0100.00012.96
5.3.160.0100.00012.75
5.3.150.0070.00312.96
5.3.140.0050.00512.95
5.3.130.0080.00312.87
5.3.120.0070.00412.96
5.3.110.0050.00512.72
5.3.100.0110.00012.73
5.3.90.0080.00313.02
5.3.80.0060.00312.73
5.3.70.0030.00612.83
5.3.60.0060.00312.67
5.3.50.0070.00312.78
5.3.40.0100.00012.59
5.3.30.0070.00212.57
5.3.20.0030.00712.79
5.3.10.0060.00312.39
5.3.00.0050.00512.50
5.2.170.0040.00411.91
5.2.160.0090.00011.61
5.2.150.0030.00511.68
5.2.140.0030.00511.88
5.2.130.0000.00811.86
5.2.120.0000.00911.85
5.2.110.0040.00411.84
5.2.100.0060.00311.84
5.2.90.0060.00311.86
5.2.80.0030.00611.73
5.2.70.0030.00611.70
5.2.60.0030.00611.42
5.2.50.0080.00011.84
5.2.40.0040.00411.62
5.2.30.0000.00811.55
5.2.20.0090.00011.58
5.2.10.0050.00411.26
5.2.00.0080.00011.40
5.1.60.0080.00010.90
5.1.50.0040.00410.66
5.1.40.0040.00410.81
5.1.30.0060.00210.87
5.1.20.0050.00310.96
5.1.10.0040.00410.70
5.1.00.0080.00010.77
5.0.50.0040.00210.14
5.0.40.0070.00010.14
5.0.30.0080.00010.14
5.0.20.0000.00710.14
5.0.10.0030.00310.14
5.0.00.0000.00610.14
4.4.90.0030.00010.14
4.4.80.0000.00410.14
4.4.70.0040.00010.14
4.4.60.0030.00010.14
4.4.50.0000.00410.14
4.4.40.0040.00010.14
4.4.30.0040.00010.14
4.4.20.0000.00410.14
4.4.10.0040.00010.14
4.4.00.0000.00410.14
4.3.110.0040.00010.14
4.3.100.0030.00010.14
4.3.90.0000.00410.14
4.3.80.0000.00410.14
4.3.70.0040.00010.14
4.3.60.0040.00010.14
4.3.50.0040.00010.14
4.3.40.0030.00010.14
4.3.30.0030.00010.14
4.3.20.0000.00310.14
4.3.10.0000.00310.14
4.3.00.0000.00210.14

preferences:
25.01 ms | 406 KiB | 5 Q