3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Command{ /** @var callable $code */ private $code; /** * @param callable $code */ public function setCode(callable $code): static { $this->code = $code; return $this; } public function execute(): void { ($this->code)(); } } class CustomCommand extends Command{ public function __construct(){ parent::setCode([$this, 'runCustomCommand']); } protected function runCustomCommand(): void { echo 'Protected function called'; } } $code = new CustomCommand(); $code->execute();

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.110.0060.00320.94
8.3.100.0100.00316.50
8.3.90.0080.00018.11
8.3.80.0430.00730.84
8.3.70.0430.00730.84
8.3.60.0530.00430.84
8.3.50.0080.01230.84
8.3.40.0290.01130.84
8.3.30.0300.00930.84
8.3.20.0350.00830.84
8.3.10.0410.00330.84
8.3.00.0390.00930.84
8.2.230.0060.00322.58
8.2.220.0090.00024.06
8.2.210.0100.01026.77
8.2.200.0210.01130.84
8.2.190.0250.00930.84
8.2.180.0270.00030.84
8.2.170.0200.00030.84
8.2.160.0320.00330.84
8.2.150.0360.00430.84
8.2.140.0320.01030.84
8.2.130.0280.01130.84
8.2.120.0280.01130.84
8.2.110.0330.00630.84
8.2.100.0140.00530.84
8.2.90.0140.00530.84
8.2.80.0160.00430.84
8.2.70.0190.00030.84
8.2.60.0160.00330.84
8.2.50.0170.00230.84
8.2.40.0110.00830.84
8.2.30.0060.01230.84
8.2.20.0160.00330.84
8.2.10.0320.00630.84
8.2.00.0310.01030.84
8.1.290.0320.00630.84
8.1.280.0330.00330.84
8.1.270.0320.01130.84
8.1.260.0390.00430.84
8.1.250.0360.00730.84
8.1.240.0290.00430.84
8.1.230.0250.01330.84
8.1.220.0300.00730.84
8.1.210.0330.00430.84
8.1.200.0320.00730.84
8.1.190.0340.00430.84
8.1.180.0310.01130.84
8.1.170.0310.00630.84
8.1.160.0320.01130.84
8.1.150.0280.00930.84
8.1.140.0270.00630.84
8.1.130.0260.01230.84
8.1.120.0300.00830.84
8.1.110.0310.00630.84
8.1.100.0310.00730.84
8.1.90.0200.01430.84
8.1.80.0100.01430.84
8.1.70.0170.00030.84
8.1.60.0420.00330.84
8.1.50.0300.00630.84
8.1.40.0180.00730.84
8.1.30.0140.01130.84
8.1.20.0170.00230.84
8.1.10.0200.00630.84
8.1.00.0160.00430.84

preferences:
29.63 ms | 403 KiB | 5 Q