3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* In each Child::foo() scenario, Parent::foo() cannot be intercepted (mocked) */ class Parent { public function foo() { echo 'Parent' . PHP_EOL; } } // Calling parent:: class Child_1 extends Parent { public function foo() { echo 'Child_1' . PHP_EOL; // Follow the method chin upward - Parent::foo() parent::foo(); } } class Mock_Child_1 extends Child_1 { public function foo() { echo 'Mock 1' . PHP_EOL; // Follow the method chain upward - Child_1::foo() parent::foo(); } } $mock1 = new Mock_Child_1(); $mock->foo(); /* Result: * Mock 1 * Child 1 * Parent - but we weren't able to intercept this to change its output! */ // Calling $this class Child_2 extends Parent { public function foo() { echo 'Child_2' . PHP_EOL; // Call the lowest foo() in the instance $this->foo(); } } class Mock_Child_2 extends Child_1 { public function foo() { echo 'Mock 2' . PHP_EOL; // Call the lowest foo() in the instance $this->foo(); } } $mock2 = new Mock_Child_2(); $mock->foo(); /* Result: * Mock 2 * Mock 2 ... (infinite) * * Mock_Child must call parent::foo() to get any higher in the chain */ // Mix class Child_3 extends Parent { public function foo() { echo 'Child_3' . PHP_EOL; // Call the lowest foo() in the instance $this->foo(); } } class Mock_Child_3 extends Child_1 { public function foo() { echo 'Mock 3' . PHP_EOL; // Follow the method chain upward - Child_2::foo() parent::foo(); } } $mock3 = new Mock_Child_3(); $mock->foo(); /* Result: * Mock 3 * Child 3 * Mock 3 * Child 3 ... (infinite) */

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.00.0030.00626.16
8.2.130.0090.00026.16
8.2.120.0080.00026.16
8.2.110.0090.00026.16
8.2.100.0060.00326.16
8.2.90.0060.00326.16
8.2.80.0060.00326.16
8.2.70.0040.00426.16
8.2.60.0060.00326.16
8.2.50.0030.00626.16
8.2.40.0060.00326.16
8.2.30.0000.00826.16
8.2.20.0040.00426.16
8.2.10.0030.00626.16
8.2.00.0030.00626.16
8.1.260.0090.00026.16
8.1.250.0000.00826.16
8.1.240.0040.00426.16
8.1.230.0040.00426.16
8.1.220.0080.00026.16
8.1.210.0000.00926.16
8.1.200.0040.00426.16
8.1.190.0030.00626.16
8.1.180.0090.00026.16
8.1.170.0030.00626.16
8.1.160.0030.00626.16
8.1.150.0080.00026.16
8.1.140.0030.00526.16
8.1.130.0000.00926.16
8.1.120.0000.00926.16
8.1.110.0060.00326.16
8.1.100.0060.00326.16
8.1.90.0060.00326.16
8.1.80.0090.00026.16
8.1.70.0040.00426.16
8.1.60.0060.00326.16
8.1.50.0090.00026.16
8.1.40.0080.00026.16
8.1.30.0060.00326.16
8.1.20.0060.00326.16
8.1.10.0090.00026.16
8.1.00.0040.00426.16
8.0.300.0060.00326.16
8.0.290.0080.00326.16
8.0.280.0090.00026.16
8.0.270.0050.00526.16
8.0.260.0110.00026.16
8.0.250.0070.00426.16
8.0.240.0040.00726.16
8.0.230.0050.00526.16
8.0.220.0030.00626.16
8.0.210.0030.00726.16
8.0.200.0080.00326.16
8.0.190.0030.00726.16
8.0.180.0030.00626.16
8.0.170.0030.00726.16
8.0.160.0090.00026.16
8.0.150.0000.00926.16
8.0.140.0100.00026.16
8.0.130.0000.00826.16
8.0.120.0080.00026.16
8.0.110.0080.00026.16
8.0.100.0040.00426.16
8.0.90.0060.00326.16
8.0.80.0080.00326.16
8.0.70.0110.00026.16
8.0.60.0030.00626.16
8.0.50.0060.00326.16
8.0.30.0000.00926.16
8.0.20.0000.00926.16
8.0.10.0040.00426.16

preferences:
141.56 ms | 1005 KiB | 7 Q