3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ancestor { public $publicVar = "ancestor's public var\n"; static $staticVar = "ancestor's static var\n"; function publicMethod(){ echo "this is ancestor's public method\n"; // is $this is set up if(isset($this)){ echo "publicMethod is in object context\n"; }else{ echo "publicMethod is in static context\n"; } } static function staticMethod(){ echo "this is ancestor's static method\n"; // is $this is set up if(isset($this)){ echo "staticMethod is in object context\n"; }else{ echo "staticMethod is in static context\n"; } } } class Descendant extends Ancestor { public $publicVar = "descendant's public var\n"; static $staticVar = "descendant's static var\n"; function publicMethod(){ echo "this is descendant's public method\n"; // is $this is set up if(isset($this)){ echo "publicMethod is in object context\n"; }else{ echo "publicMethod is in static context\n"; } } static function staticMethod(){ echo "this is descendant's static method\n"; // is $this is set up if(isset($this)){ echo "staticMethod is in object context\n"; }else{ echo "staticMethod is in static context\n"; } } } $ancestor = new Ancestor(); $descendant = new Descendant(); // From Outside Of An Instance/Class: // access to properties echo $descendant->publicVar; // descendant's public var echo $descendant->staticVar; // "" + notice: Undefined property: Descendant::$staticVar echo $descendant::$staticVar; // descendant's static var //echo $descendant::$publicVar; // fatal error: Access to undeclared static property: Descendant::$publicVar //echo Ancestor::$publicVar; // fatal error: Access to undeclared static property echo Ancestor::$staticVar; //ancestor's static var //echo Descendant::$publicVar; // fatal error: Access to undeclared static property echo Descendant::$staticVar; // descendant's static var // access to methods $descendant->publicMethod(); $descendant->staticMethod(); $descendant::staticMethod(); $descendant::publicMethod(); //Ancestor::publicMethod();

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.50
8.3.50.0110.00716.39
8.3.40.0000.01518.94
8.3.30.0090.00918.67
8.3.20.0040.00420.39
8.3.10.0050.00323.65
8.3.00.0040.00419.44
8.2.180.0040.01816.88
8.2.170.0090.00622.96
8.2.160.0070.00720.11
8.2.150.0040.00424.18
8.2.140.0070.01124.66
8.2.130.0000.00726.16
8.2.120.0080.00017.63
8.2.110.0030.00722.07
8.2.100.0090.00317.63
8.2.90.0080.00019.17
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0000.00818.04
8.2.50.0060.00318.07
8.2.40.0040.00421.00
8.2.30.0090.00019.92
8.2.20.0050.00317.80
8.2.10.0040.00417.89
8.2.00.0070.00418.04
8.1.280.0140.00325.92
8.1.270.0120.00620.22
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.01623.98
8.1.230.0080.00417.48
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0070.00317.35
8.1.190.0050.00317.23
8.1.180.0040.00418.10
8.1.170.0000.00818.50
8.1.160.0000.00721.94
8.1.150.0050.00318.69
8.1.140.0050.00317.37
8.1.130.0030.00517.63
8.1.120.0080.00017.29
8.1.110.0040.00417.38
8.1.100.0030.00617.34
8.1.90.0040.00317.28
8.1.80.0060.00317.34
8.1.70.0030.00317.45
8.1.60.0030.00517.58
8.1.50.0040.00417.46
8.1.40.0050.00317.39
8.1.30.0000.00917.71
8.1.20.0000.00717.64
8.1.10.0060.00317.43
8.1.00.0030.00617.55
8.0.300.0000.00818.77
8.0.290.0050.00216.88
8.0.280.0040.00418.43
8.0.270.0030.00317.27
8.0.260.0030.00317.30
8.0.250.0070.00017.02
8.0.240.0080.00017.00
8.0.230.0040.00416.89
8.0.220.0000.00716.75
8.0.210.0060.00316.82
8.0.200.0060.00016.83
8.0.190.0040.00416.90
8.0.180.0040.00416.82
8.0.170.0000.00916.79
8.0.160.0040.00416.95
8.0.150.0000.00716.74
8.0.140.0000.00816.86
8.0.130.0030.00313.30
8.0.120.0080.00016.84
8.0.110.0040.00416.82
8.0.100.0000.00816.84
8.0.90.0040.00416.70
8.0.80.0140.00516.77
8.0.70.0000.00716.76
8.0.60.0000.00716.93
8.0.50.0000.00716.95
8.0.30.0090.00817.15
8.0.20.0110.00717.40
8.0.10.0070.00017.04
8.0.00.0120.00616.84
7.4.330.0000.00515.08
7.4.320.0030.00316.52
7.4.300.0000.00716.62
7.4.290.0040.00416.60
7.4.280.0040.00416.63
7.4.270.0030.00316.50
7.4.260.0030.00316.53
7.4.250.0040.00416.43
7.4.240.0030.00316.53
7.4.230.0000.00716.70
7.4.220.0090.00916.57
7.4.210.0060.01016.54
7.4.200.0040.00416.39
7.4.160.0140.00316.76
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0080.01016.54
7.4.120.0060.01416.51
7.4.110.0130.00616.64
7.4.100.0110.00616.36
7.4.90.0070.01016.54
7.4.80.0100.01119.39
7.4.70.0110.00616.34
7.4.60.0040.01516.32
7.4.50.0030.00616.54
7.4.40.0080.00816.48
7.4.30.0080.00716.68
7.4.00.0060.00614.71
7.3.330.0060.00013.36
7.3.320.0050.00013.27
7.3.310.0070.00016.43
7.3.300.0040.00416.45
7.3.290.0060.01116.44
7.3.280.0120.00816.41
7.3.270.0060.01217.40
7.3.260.0190.00616.67
7.3.250.0080.01016.54
7.3.240.0070.01016.44
7.3.230.0150.00316.39
7.3.210.0090.00916.53
7.3.200.0080.00816.35
7.3.190.0080.00816.30
7.3.180.0170.00016.29
7.3.170.0060.01316.36
7.3.160.0060.01316.52
7.2.330.0130.00916.75
7.2.320.0150.00616.32
7.2.310.0130.01016.44
7.2.300.0140.00316.82
7.2.290.0070.01416.45
7.2.60.0040.00816.79
7.2.00.0000.01219.38
7.1.200.0060.00615.61
7.1.100.0000.01418.25
7.1.70.0030.00617.16
7.1.60.0000.01720.03
7.1.50.0140.01116.87
7.1.00.0030.07722.37
7.0.200.0060.00316.71
7.0.100.0130.08319.98
7.0.90.0030.04319.94
7.0.80.0070.07720.14
7.0.70.0100.07020.04
7.0.60.0100.06319.99
7.0.50.0200.05720.32
7.0.40.0100.08320.16
7.0.30.0070.08320.03
7.0.20.0100.05320.07
7.0.10.0070.04020.08
7.0.00.0070.04020.08
5.6.280.0030.05721.11
5.6.250.0070.07320.75
5.6.240.0100.07720.59
5.6.230.0130.06720.70
5.6.220.0170.07020.69
5.6.210.0200.07320.59
5.6.200.0270.06720.97
5.6.190.0100.04720.90
5.6.180.0170.07721.17
5.6.170.0070.08321.10
5.6.160.0030.04721.02
5.6.150.0030.04321.11
5.6.140.0170.03321.02
5.6.130.0000.04720.96
5.6.120.0070.08021.08
5.6.110.0100.03721.03
5.6.100.0000.04721.12
5.6.90.0000.08020.99
5.6.80.0000.08720.34
5.6.70.0000.04720.44
5.6.60.0070.06720.32
5.6.50.0070.03320.33
5.6.40.0030.04020.43
5.6.30.0070.04020.41
5.6.20.0000.04320.36
5.6.10.0000.04720.39
5.6.00.0030.04320.29
5.5.380.0100.07320.36
5.5.370.0030.08720.40
5.5.360.0030.05320.45
5.5.350.0000.04720.38
5.5.340.0200.06320.80
5.5.330.0100.07020.81
5.5.320.0030.08720.84
5.5.310.0100.08320.88
5.5.300.0070.03720.92
5.5.290.0030.04020.88
5.5.280.0030.05020.73
5.5.270.0070.04320.86
5.5.260.0030.04020.89
5.5.250.0070.04320.71
5.5.240.0030.04020.27
5.5.230.0030.05020.21
5.5.220.0030.04020.15
5.5.210.0070.04020.15
5.5.200.0000.04320.23
5.5.190.0070.03720.24
5.5.180.0030.03720.27
5.5.160.0030.04020.24
5.5.150.0030.05020.27
5.5.140.0070.04020.11
5.5.130.0070.03720.08
5.5.120.0030.04320.22
5.5.110.0030.04320.10
5.5.100.0000.04320.02
5.5.90.0030.03720.09
5.5.80.0030.03720.11
5.5.70.0070.03720.09
5.5.60.0000.04020.15
5.5.50.0070.03320.00
5.5.40.0070.03720.15
5.5.30.0130.07320.05
5.5.20.0030.07020.15
5.5.10.0000.06720.03
5.5.00.0030.08020.11
5.4.450.0000.04319.41
5.4.440.0070.04019.29
5.4.430.0000.05719.55
5.4.420.0100.03319.44
5.4.410.0070.04319.34
5.4.400.0100.03718.91
5.4.390.0030.04019.03
5.4.380.0070.03319.18
5.4.370.0000.04319.14
5.4.360.0100.03319.09
5.4.350.0000.04019.14
5.4.340.0070.03719.12
5.4.320.0000.04319.19
5.4.310.0070.03319.13
5.4.300.0000.04719.23
5.4.290.0170.02319.18
5.4.280.0070.05718.89
5.4.270.0000.04319.02
5.4.260.0030.03719.13
5.4.250.0070.03319.16
5.4.240.0000.04019.02
5.4.230.0030.04019.22
5.4.220.0070.03319.08
5.4.210.0070.03719.02
5.4.200.0070.03719.14
5.4.190.0100.03018.83
5.4.180.0130.03019.20
5.4.170.0000.04319.15
5.4.160.0100.07318.82
5.4.150.0070.07319.19
5.4.140.0130.04016.33
5.4.130.0030.07716.48
5.4.120.0030.05016.43
5.4.110.0100.06716.32
5.4.100.0070.04716.54
5.4.90.0100.05016.48
5.4.80.0100.03716.49
5.4.70.0130.06316.52
5.4.60.0130.05316.46
5.4.50.0070.03316.36
5.4.40.0030.06316.53
5.4.30.0030.08016.45
5.4.20.0070.07016.39
5.4.10.0100.05316.39
5.4.00.0030.07715.80

preferences:
51.11 ms | 400 KiB | 5 Q