3v4l.org

run code in 300+ PHP versions simultaneously
<?php // User with a protected method class User { protected function getSomething(): string { return 'data from User'; } } // class Student that extend it class Student extends User { public function thisWorks(): void { echo 'Calling protected method from parent: ' . $this->getSomething() . "\n"; } } $s = new Student(); // Note that in this example we call a public method from "the outside" (here). $s->thisWorks(); // This does not work, because this is "global scope". // Protected methods can only be called from withing the class, as in the example above. $s->getSomething();

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.4.120.0040.00520.93
8.4.110.0100.01022.67
8.4.100.0140.00917.88
8.4.90.0120.00818.64
8.4.80.0040.00619.94
8.4.70.0120.00718.24
8.4.60.0140.00720.34
8.4.50.0110.00917.91
8.4.40.0170.00318.01
8.4.30.0120.00318.61
8.4.20.0070.00419.59
8.4.10.0040.00419.60
8.3.250.0040.00418.79
8.3.240.0130.00716.58
8.3.230.0130.00716.50
8.3.220.0140.00517.00
8.3.210.0110.00916.54
8.3.200.0120.00516.48
8.3.190.0080.00617.29
8.3.180.0090.01116.45
8.3.170.0080.00816.52
8.3.160.0030.00716.75
8.3.150.0080.00017.36
8.3.140.0030.00516.68
8.3.130.0060.00318.45
8.3.120.0090.00920.82
8.3.110.0130.00620.94
8.3.100.0090.00616.70
8.3.90.0130.00626.77
8.3.80.0040.00426.77
8.3.50.0030.00626.77
8.2.290.0130.00620.50
8.2.280.0120.00818.39
8.2.270.0040.01519.05
8.2.260.0040.00416.90
8.2.250.0100.00718.69
8.2.240.0150.00018.77
8.2.230.0080.00022.58
8.2.220.0090.00024.06
8.2.210.0070.01026.77
8.2.200.0070.01126.77
8.1.330.0100.00821.88
8.1.320.0120.00916.44
8.1.310.0040.00418.50
8.1.300.0080.01120.07
8.1.290.0080.00026.77
7.2.340.0200.00916.00
7.2.60.0320.00516.20
5.6.400.0100.00415.22

preferences:
24.02 ms | 403 KiB | 5 Q