3v4l.org

run code in 500+ PHP versions simultaneously
<?php /** * segfault test * * I encountered during app bug hunt, whereby instead of * `$w->method()` it called `$this->method()`. * * However, I discovered that infinite recursion which * usually triggers memory limit or max_recursion_depth * * For minimal testcase for segfault see: method4() */ class Y { public function method() { } } class X { public function method(): array { $ws = [new Y]; return array_map(function ($w) { return ['id' => 3, 'something' => $this->method()]; // this effectivly recurses (I was debugging a typo, this should have been `$w->method()`) }, $ws); } public function method2() { $this->method2(); } public function method3() { $a = function (){ $this->method3(); }; $a(); } // minimal testcase for segfault <---------------------- MINIMAL TESTCASE public function method4() { $a = function (){ $this->method4(); }; array_map($a,[1]); } } // original test-harnes // (new X)->method(); // Allowed memory size exhausted // (new X)->method2(); // also, Allowed memory size exhausted //(new X)->method3(); // minimal testcase for segfault (new X)->method4();

Abusive script

This script was stopped while abusing our resources

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.40.0370.03762.25
8.4.30.0240.00763.44
8.4.20.0460.01065.17
8.4.10.0290.02266.30
8.3.160.0600.02962.68
8.3.150.0400.02763.10
8.3.140.0310.01762.54
8.3.130.0290.01662.67
8.3.120.0410.02564.98
8.3.110.0300.02064.15
8.3.100.0520.02862.77
8.3.90.0220.00765.30
8.3.80.0300.01762.70
8.3.70.0540.03462.69
8.3.60.0440.02463.05
8.3.50.0620.03664.25
8.3.40.0440.01449.46
8.3.30.0400.01647.92
8.3.20.0170.01050.98
8.3.10.0210.00751.14
8.3.00.0190.01051.10
8.2.270.0210.02137.19
8.2.260.0350.00337.92
8.2.250.0370.00737.48
8.2.240.0240.01038.90
8.2.230.0170.00337.13
8.2.220.0170.00737.54
8.2.210.0210.00038.82
8.2.200.0210.00037.02
8.2.190.0230.01337.18
8.2.180.0230.01338.32
8.2.170.0430.01339.72
8.2.160.0230.01341.57
8.2.150.0160.00641.39
8.2.140.0180.00340.08
8.2.130.0110.01140.38
8.2.120.0150.00340.39
8.2.110.0140.00740.89
8.2.100.0350.00339.03
8.2.90.0160.00340.21
8.2.80.0130.00638.50
8.2.70.0170.00338.50
8.2.60.0190.00038.93
8.2.50.0160.00338.38
8.2.40.0140.00441.44
8.2.30.0170.00039.08
8.2.20.0070.01041.66
8.2.10.0140.00439.33
8.2.00.0100.01040.38
8.1.310.0460.01340.70
8.1.300.0170.00740.02
8.1.290.0210.00340.13
8.1.280.0320.01641.73
8.1.270.0210.01446.15
8.1.260.0130.00646.16
8.1.250.0120.00344.62
8.1.240.0190.00045.16
8.1.230.0340.00641.64
8.1.220.0120.00941.55
8.1.210.0130.01041.48
8.1.200.0140.01041.10
8.1.190.0200.00340.60
8.1.180.0090.01241.48
8.1.170.0130.01042.64
8.1.160.0100.00742.98
8.1.150.0090.00942.66
8.1.140.0190.00341.44
8.1.130.0160.00641.94
8.1.120.0130.00542.29
8.1.110.0120.00642.32
8.1.100.0080.00942.28
8.1.90.0110.00742.32
8.1.80.0130.00542.28
8.1.70.0120.00542.38
8.1.60.0070.01042.48
8.1.50.0070.01042.46
8.1.40.0090.00842.47
8.1.30.0090.00942.48
8.1.20.0110.00842.43
8.1.10.0100.00742.37
8.1.00.0120.00642.27
8.0.300.0080.01137.97
8.0.290.0110.00737.62
8.0.280.0110.00639.54
8.0.270.0040.01838.20
8.0.260.0080.00838.62
8.0.250.0090.00938.62
8.0.240.0110.00438.69
8.0.230.0110.00638.70
8.0.220.0060.01038.63
8.0.210.0130.00338.82
8.0.200.0110.00538.88
8.0.190.0110.00638.86
8.0.180.0070.01038.77
8.0.170.0110.00539.03
8.0.160.0100.00738.83
8.0.150.0110.00638.72
8.0.140.0120.00738.76
8.0.130.0110.00638.75
8.0.120.0120.00638.72
8.0.110.0130.00438.75
8.0.100.0090.00738.75
8.0.90.0090.00638.73
8.0.80.0090.00738.84
8.0.70.0080.00838.76
8.0.60.0120.00538.74
8.0.50.0100.00738.87
8.0.30.0110.00638.73
8.0.20.0090.00838.77
8.0.10.0050.01238.83

preferences:
96.41 ms | 1460 KiB | 5 Q