3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * This base class defines two methods of interest, one private, one protected. * * It also includes 3 ways to invoke these methods from outside. */ class Base { /** * A private base method */ private function priv() { echo __CLASS__ . " Private\n"; } /** * A protected base method */ protected function prot() { echo __CLASS__ . " Protected\n"; } /** * Expose the private method */ public function callPriv() { $this->priv(); } /** * Expose the protected method */ public function callProt() { $this->prot(); } /** * Expose either method via call_user_func(). */ public function call($method) { call_user_func([$this, $method]); } /** * Expose either method using Reflection. */ public function reflect($method) { $rm = new ReflectionMethod($this, $method); if (!$rm->isPublic()) { $rm->setAccessible(true); } $rm->invoke($this); } } /** * Class Child redefines the methods of interest. Will overrides apply ? */ class Child extends Base { /** * A child private method. Does it override the base method ? */ private function priv() { echo __CLASS__ . " Private\n"; } /** * A child protected method. Does it override the base method ? */ protected function prot() { echo __CLASS__ . " Protected\n"; } } $f = new Child(); $f->callPriv(); $f->call('priv'); $f->reflect('priv'); echo "\n"; $f->callProt(); $f->call('prot'); $f->reflect('prot');

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.0150.00416.49
8.3.50.0120.00620.00
8.3.40.0120.00418.85
8.3.30.0090.00618.74
8.3.20.0000.00721.75
8.3.10.0040.00423.43
8.3.00.0000.00721.80
8.2.180.0150.00318.41
8.2.170.0090.00622.96
8.2.160.0090.00619.25
8.2.150.0000.00925.66
8.2.140.0080.00024.66
8.2.130.0090.00026.16
8.2.120.0030.00520.56
8.2.110.0000.00919.38
8.2.100.0130.00317.84
8.2.90.0060.00319.21
8.2.80.0050.00219.40
8.2.70.0070.00317.50
8.2.60.0040.00418.05
8.2.50.0000.00718.10
8.2.40.0030.00620.58
8.2.30.0040.00419.33
8.2.20.0040.00418.08
8.2.10.0070.00018.11
8.2.00.0040.00418.29
8.1.280.0070.01425.92
8.1.270.0090.00924.66
8.1.260.0030.00626.35
8.1.250.0000.00828.09
8.1.240.0000.01023.96
8.1.230.0040.00817.76
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0000.00917.38
8.1.190.0000.00817.25
8.1.180.0030.00518.10
8.1.170.0080.00018.63
8.1.160.0040.00418.95
8.1.150.0000.00718.85
8.1.140.0000.00719.06
8.1.130.0030.00317.61
8.1.120.0040.00417.47
8.1.110.0000.00917.48
8.1.100.0040.00417.46
8.1.90.0000.00717.39
8.1.80.0060.00317.40
8.1.70.0000.00717.53
8.1.60.0030.00617.54
8.1.50.0000.00717.62
8.1.40.0040.00417.47
8.1.30.0030.00617.70
8.1.20.0030.00517.69
8.1.10.0000.00817.54
8.1.00.0030.00517.55
8.0.300.0030.00618.77
8.0.290.0040.00416.88
8.0.280.0040.00418.50
8.0.270.0040.00417.41
8.0.260.0000.00817.31
8.0.250.0030.00317.02
8.0.240.0000.00716.90
8.0.230.0000.00717.02
8.0.220.0030.00316.96
8.0.210.0040.00416.82
8.0.200.0080.00016.93
8.0.190.0070.00017.02
8.0.180.0040.00416.98
8.0.170.0000.01117.02
8.0.160.0070.00016.79
8.0.150.0070.00316.77
8.0.140.0000.00716.89
8.0.130.0030.00313.37
8.0.120.0000.00816.91
8.0.110.0040.00416.93
8.0.100.0000.00716.98
8.0.90.0000.00716.93
8.0.80.0100.00716.91
8.0.70.0000.00716.82
8.0.60.0040.00416.88
8.0.50.0000.00817.00
8.0.30.0110.00917.11
8.0.20.0160.01117.40
8.0.10.0030.00517.06
8.0.00.0110.00816.98
7.4.330.0000.00415.55
7.4.320.0030.00316.61
7.4.300.0060.00016.64
7.4.290.0060.00316.69
7.4.280.0000.00716.47
7.4.270.0090.00016.66
7.4.260.0030.00316.65
7.4.250.0030.00316.61
7.4.240.0030.00516.54
7.4.230.0030.00316.49
7.4.220.0040.00416.65
7.4.210.0120.00616.52
7.4.200.0000.00716.37
7.4.160.0050.01116.45
7.4.150.0070.01217.40
7.4.140.0100.00917.86
7.4.130.0150.00316.57
7.4.120.0100.01016.52
7.4.110.0000.01816.55
7.4.100.0030.01316.44
7.4.90.0030.01416.70
7.4.80.0180.00619.39
7.4.70.0090.00916.54
7.4.60.0030.01316.38
7.4.50.0120.00316.46
7.4.40.0090.00916.43
7.4.20.0120.00316.52
7.4.10.0070.01215.54
7.4.00.0030.01115.62
7.3.330.0030.00313.14
7.3.320.0030.00313.34
7.3.310.0030.00316.33
7.3.300.0070.00016.18
7.3.290.0120.00516.30
7.3.280.0070.00816.30
7.3.270.0090.01217.40
7.3.260.0080.01116.37
7.3.250.0080.01016.28
7.3.240.0110.00916.33
7.3.230.0160.00016.42
7.3.210.0080.00816.49
7.3.200.0100.01016.60
7.3.190.0100.00716.17
7.3.180.0090.00916.62
7.3.170.0170.00616.41
7.3.160.0070.01416.29
7.3.140.0090.00916.33
7.3.130.0060.01315.75
7.3.120.0090.00615.76
7.3.110.0050.01215.46
7.3.100.0120.00415.50
7.3.90.0130.00615.79
7.3.80.0090.00615.52
7.3.70.0040.00815.58
7.3.60.0050.01215.63
7.3.50.0050.00915.63
7.3.40.0120.00315.34
7.3.30.0090.00615.54
7.3.20.0060.01016.49
7.3.10.0050.01016.49
7.3.00.0090.00616.28
7.2.330.0080.01116.51
7.2.320.0130.00316.73
7.2.310.0000.01616.55
7.2.300.0110.00716.71
7.2.290.0030.01916.54
7.2.270.0070.01616.66
7.2.260.0040.01215.93
7.2.250.0100.00915.97
7.2.240.0070.00916.08
7.2.230.0120.00715.89
7.2.220.0030.01415.94
7.2.210.0060.01015.69
7.2.200.0060.00715.87
7.2.190.0060.01315.96
7.2.180.0090.00915.82
7.2.170.0050.01015.91
7.2.160.0050.01015.81
7.2.150.0090.00716.81
7.2.140.0050.01116.82
7.2.130.0060.00916.84
7.2.120.0340.01015.72
7.2.110.0350.01115.70
7.2.100.0320.00715.64
7.2.90.0430.00515.71
7.2.80.0530.01115.63
7.2.70.0580.01115.89
7.2.60.0340.00916.11
7.2.50.0620.00915.83
7.2.40.0670.00915.92
7.2.30.0430.00815.83
7.2.20.0420.00615.79
7.2.10.0320.00815.78
7.2.00.0710.01016.56
7.1.330.0070.01015.73
7.1.320.0130.00615.76
7.1.310.0060.01115.71
7.1.300.0100.00715.70
7.1.290.0020.01315.58
7.1.280.0070.00915.43
7.1.270.0080.00615.45
7.1.260.0060.00815.48
7.1.250.0100.00415.51
7.1.240.0410.00814.66
7.1.230.0580.00714.66
7.1.220.0330.01014.72
7.1.210.0510.00614.67
7.1.200.0240.00814.84
7.1.190.0390.00814.55
7.1.180.0710.00814.62
7.1.170.0540.00614.58
7.1.160.0610.00814.59
7.1.150.0430.01014.58
7.1.140.0370.00614.69
7.1.130.0390.00914.63
7.1.120.0530.00615.42
7.1.110.0500.00815.17
7.1.100.0360.00715.19
7.1.90.0340.00815.20
7.1.80.0360.01015.18
7.1.70.0270.00714.99
7.1.60.0320.00720.73
7.1.50.0300.00720.78
7.1.40.0290.00920.69
7.1.30.0350.00920.75
7.1.20.0300.01220.74
7.1.10.0220.00914.62
7.1.00.0240.01014.76
7.0.330.0090.00515.13
7.0.320.0440.00614.41
7.0.310.0360.01114.44
7.0.300.0440.00514.28
7.0.290.0440.00714.28
7.0.280.0290.00914.43
7.0.270.0450.00514.45
7.0.260.0340.01015.04
7.0.250.0280.01114.86
7.0.240.0300.01114.83
7.0.230.0340.00514.86
7.0.220.0300.00714.78
7.0.210.0290.00614.52
7.0.200.0250.00814.50
7.0.190.0320.01114.57
7.0.180.0230.00914.36
7.0.170.0280.00714.44
7.0.160.0250.00814.47
7.0.150.0290.00614.41
7.0.140.0240.00614.42
7.0.130.0290.00614.52
7.0.120.0220.00714.48
7.0.110.0270.00914.40
7.0.100.1020.00914.47
7.0.90.0230.00714.39
7.0.80.0350.00714.46
7.0.70.0310.00614.41
7.0.60.0300.00814.42
7.0.50.0240.00714.44
7.0.40.0230.00614.24
7.0.30.0250.00914.12
7.0.20.0220.00814.06
7.0.10.0250.00714.16
7.0.00.0220.00714.19
5.6.400.0070.00714.95
5.6.390.0080.00615.24
5.6.380.0050.01014.76
5.6.370.0100.00814.58
5.6.360.0080.01114.56
5.6.350.0100.00914.69
5.6.340.0100.00714.74
5.6.330.0080.01214.64
5.6.320.0080.00814.55
5.6.310.0110.00614.80
5.6.300.0100.02616.75
5.6.290.0130.02716.58
5.6.280.0080.02916.75
5.6.270.0090.02616.73
5.6.260.0110.02616.74
5.6.250.0120.02416.70
5.6.240.0100.02516.76
5.6.230.0110.02616.66
5.6.220.0130.02516.72
5.6.210.0110.02616.56
5.6.200.0090.02816.83
5.6.190.0100.02516.71
5.6.180.0090.02716.66
5.6.170.0090.02816.68
5.6.160.0130.02216.67
5.6.150.0120.02316.65
5.6.140.0100.02516.59
5.6.130.0120.02216.61
5.6.120.0090.02616.74
5.6.110.0110.02416.73
5.6.100.0100.02516.61
5.6.90.0090.02416.63
5.6.80.0080.02616.37
5.6.70.0090.02516.44
5.6.60.0090.02716.53
5.6.50.0050.02916.39
5.6.40.0100.02416.38
5.6.30.0100.02316.46
5.6.20.0090.02316.48
5.6.10.0080.02316.45
5.6.00.0090.02416.40
5.5.380.0090.02213.21
5.5.370.0110.02113.37
5.5.360.0090.02213.28
5.5.350.0070.02413.30
5.5.340.0120.02113.43
5.5.330.0090.02313.37
5.5.320.0120.02013.28
5.5.310.0130.02913.35
5.5.300.0120.02013.30
5.5.290.0110.02813.22
5.5.280.0110.02213.39
5.5.270.0090.02513.23
5.5.260.0160.02213.38
5.5.250.0120.02013.15
5.5.240.0090.02313.12
5.5.230.0110.02513.09
5.5.220.0090.02213.20
5.5.210.0120.01813.19
5.5.200.0080.02112.97
5.5.190.0080.02413.11
5.5.180.0120.02413.07
5.5.170.0040.01514.34
5.5.160.0060.02413.07
5.5.150.0050.02413.05
5.5.140.0090.02113.19
5.5.130.0090.02513.10
5.5.120.0040.02713.19
5.5.110.0110.02013.10
5.5.100.0140.01613.09
5.5.90.0100.02013.10
5.5.80.0110.02113.17
5.5.70.0090.02213.00
5.5.60.0070.02312.91
5.5.50.0110.02013.09
5.5.40.0090.02113.01
5.5.30.0050.02413.12
5.5.20.0080.02613.14
5.5.10.0070.02213.04
5.5.00.0080.02313.02
5.4.450.0130.02813.74
5.4.440.0100.02313.87
5.4.430.0130.02413.79
5.4.420.0110.02713.82
5.4.410.0120.02313.70
5.4.400.0100.02213.66
5.4.390.0110.02713.67
5.4.380.0100.02213.72
5.4.370.0100.02113.63
5.4.360.0080.02213.84
5.4.350.0140.01613.64
5.4.340.0090.02413.80
5.4.330.0090.00511.08
5.4.320.0130.02213.81
5.4.310.0070.02313.80
5.4.300.0110.02113.79
5.4.290.0120.02313.74
5.4.280.0130.02113.83
5.4.270.0100.02713.65
5.4.260.0120.01813.60
5.4.250.0070.03013.73
5.4.240.0070.02413.64
5.4.230.0100.02113.74
5.4.220.0160.01513.61
5.4.210.0110.02113.65
5.4.200.0110.02313.76
5.4.190.0070.02613.59
5.4.180.0090.02613.63
5.4.170.0100.02113.74
5.4.160.0070.02213.56
5.4.150.0090.02813.64
5.4.140.0080.02512.87
5.4.130.0110.01712.98
5.4.120.0110.02412.85
5.4.110.0060.02312.88
5.4.100.0080.02313.01
5.4.90.0100.01912.91
5.4.80.0080.02312.89
5.4.70.0050.02513.02
5.4.60.0070.02212.87
5.4.50.0090.02112.96
5.4.40.0120.01812.96
5.4.30.0120.01812.84
5.4.20.0130.01712.84
5.4.10.0100.02212.85
5.4.00.0100.01812.67
5.3.290.0120.01812.05
5.3.280.0080.02211.98
5.3.270.0080.02211.94
5.3.260.0100.02112.04
5.3.250.0100.01912.01
5.3.240.0090.02011.92
5.3.230.0070.02111.92
5.3.220.0110.01711.97
5.3.210.0090.02111.92
5.3.200.0080.02011.91
5.3.190.0080.02112.01
5.3.180.0050.02412.01
5.3.170.0120.02512.00
5.3.160.0130.01912.03
5.3.150.0090.02211.97
5.3.140.0050.02211.97
5.3.130.0090.02111.92
5.3.120.0110.02211.96
5.3.110.0110.01912.04
5.3.100.0080.02011.82
5.3.90.0120.01811.81
5.3.80.0100.01911.79
5.3.70.0070.02211.71
5.3.60.0030.02511.72
5.3.50.0080.02111.73
5.3.40.0080.02611.71
5.3.30.0130.02011.71
5.3.20.0050.02111.69
5.3.10.0130.01511.58
5.3.00.0080.02111.61
5.2.170.0030.02110.72
5.2.160.0060.01710.71
5.2.150.0030.02010.73
5.2.140.0050.01910.64
5.2.130.0070.02110.68
5.2.120.0080.01510.67
5.2.110.0060.01710.63
5.2.100.0080.01510.63
5.2.90.0080.01710.67
5.2.80.0020.02710.61
5.2.70.0090.01910.68
5.2.60.0040.01910.70
5.2.50.0070.01610.67
5.2.40.0040.01810.64
5.2.30.0040.01910.58
5.2.20.0070.01610.56
5.2.10.0070.01510.49
5.2.00.0090.01510.59
5.1.60.0040.02010.33
5.1.50.0040.01710.34
5.1.40.0070.01310.24
5.1.30.0040.01810.46
5.1.20.0040.01810.46
5.1.10.0080.01210.36
5.1.00.0070.01310.37
5.0.50.0060.0119.99
5.0.40.0070.0119.99
5.0.30.0050.0159.99
5.0.20.0070.0089.99
5.0.10.0070.0129.99
5.0.00.0040.0189.99
4.4.90.0050.0089.99
4.4.80.0030.0109.99
4.4.70.0010.0129.99
4.4.60.0020.0119.99
4.4.50.0050.0089.99
4.4.40.0040.0149.99
4.4.30.0050.0099.99
4.4.20.0050.0089.99
4.4.10.0020.0119.99
4.4.00.0010.0169.99
4.3.110.0060.0109.99
4.3.100.0070.0069.99
4.3.90.0040.0089.99
4.3.80.0040.0139.99
4.3.70.0030.0109.99
4.3.60.0050.0099.99
4.3.50.0040.0099.99
4.3.40.0070.0129.99
4.3.30.0020.0139.99
4.3.20.0040.0089.99
4.3.10.0040.0089.99
4.3.00.0050.0089.99

preferences:
35.63 ms | 401 KiB | 5 Q