3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private function customErrorHandler(int $code, string $msg): bool { var_dump(preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg)); return true; } protected function write(): void { set_error_handler([$this, 'customErrorHandler']); try { $stream = fopen('logs://userfrosting.log', 'a'); trigger_error('Test test'); } finally { restore_error_handler(); } } public function test() { $this->write(); } } class Bar { public function customErrorHandler(int $code, string $msg): bool { var_dump(preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg)); return true; } protected function write(): void { set_error_handler([$this, 'customErrorHandler']); try { $stream = fopen('logs://userfrosting.log', 'a'); trigger_error('Test test'); } finally { restore_error_handler(); } } public function test() { $this->write(); } } class StreamHandler { public $context; public function stream_open(string $path, string $mode, int $options, ?string &$opened_path): bool { $path = str_replace('logs://', '', $path); return @fopen($path, $mode); } } stream_wrapper_register('logs', StreamHandler::class); (new Bar)->test(); (new Foo)->test();

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.120.0130.00320.71
8.3.110.0060.00320.94
8.3.100.0030.00717.04
8.3.90.0080.01226.77
8.3.80.0090.00016.75
8.3.70.0130.00317.13
8.3.60.0030.01318.61
8.3.50.0060.01118.65
8.3.40.0210.00918.53
8.3.30.0210.01018.62
8.3.20.0270.00818.48
8.3.10.0250.00917.68
8.3.00.0300.00817.56
8.2.240.0060.00317.46
8.2.230.0060.00322.58
8.2.220.0040.00424.06
8.2.210.0050.00326.77
8.2.200.0060.00318.79
8.2.190.0110.00617.13
8.2.180.0250.00817.78
8.2.170.0320.00617.93
8.2.160.0200.01417.75
8.2.150.0300.00517.68
8.2.140.0310.00817.50
8.2.130.0330.00817.56
8.2.120.0330.00217.69
8.2.110.0230.01017.75
8.2.100.0250.01018.50
8.2.90.0310.00517.73
8.2.80.0300.00518.56
8.2.70.0300.00718.50
8.2.60.0280.00419.39
8.2.50.0280.00617.56
8.2.40.0270.00417.49
8.2.30.0270.00518.71
8.2.20.0260.00717.37
8.2.10.0210.01117.56
8.2.00.0200.01418.38
8.1.300.0030.00618.35
8.1.290.0060.00330.84
8.1.280.0260.00717.36
8.1.270.0280.00718.20
8.1.260.0280.00817.24
8.1.250.0280.00917.19
8.1.240.0270.00417.18
8.1.230.0150.01517.49
8.1.220.0240.01017.36
8.1.210.0210.01117.13
8.1.200.0190.01117.19
8.1.190.0250.00817.35
8.1.180.0260.00618.12
8.1.170.0190.01218.04
8.1.160.0200.01117.19
8.1.150.0310.00317.24
8.1.140.0290.00317.24
8.1.130.0220.00918.11
8.1.120.0260.00818.09
8.1.110.0240.00717.44
8.1.100.0250.00617.18
8.1.90.0200.01017.22
8.1.80.0220.00917.18
8.1.70.0230.00817.31
8.1.60.0240.00817.31
8.1.50.0280.00517.42
8.1.40.0260.01019.19
8.1.30.0240.01019.20
8.1.20.0250.00718.25
8.1.10.0340.00318.19
8.1.00.0230.01517.19

preferences:
30.98 ms | 403 KiB | 5 Q