3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $box; public function setBox(array $box) { if (count($box) !== 4) { throw new InvalidArgumentException('The "$box" parameter must be an array with 4 values.'); } // Breaks FPM and gives a 502 due to connection reset by peers $this->box = $box; list($lat1, $lon1, $lat2, $lon2) = $this->box; // Works perfectly fine // $this->box = $box; // list($lat1, $lon1, $lat2, $lon2) = $this->box; // Calculate the central point of the box for distances $this->lat = (float) $lat1 + (($lat2 - $lat1) / 2); $this->lon = (float) $lon1 + (($lon2 - $lon1) / 2); return $this; } public function process() { if ($this->box) { list($lat1, $lon1, $lat2, $lon2) = $this->box; } echo "Success"; } } $foo = new Foo; $foo->setBox($r = explode(',', '40.688235,-74.013718,40.756427,-73.958770')); $foo->process();

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.60.0070.01018.41
8.3.50.0080.00721.26
8.3.40.0140.00318.79
8.3.30.0130.00020.35
8.3.20.0050.00320.53
8.3.10.0060.00321.04
8.3.00.0030.00621.77
8.2.180.0170.00016.75
8.2.170.0150.00018.86
8.2.160.0050.00822.96
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00421.07
8.2.110.0030.00720.53
8.2.100.0060.00617.78
8.2.90.0030.00518.16
8.2.80.0050.00318.22
8.2.70.0040.00417.63
8.2.60.0040.00417.63
8.2.50.0040.00719.35
8.2.40.0000.00919.47
8.2.30.0000.00819.39
8.2.20.0040.00417.79
8.2.10.0050.00217.75
8.2.00.0040.00417.85
8.1.280.0170.00025.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0060.00328.09
8.1.240.0070.00422.00
8.1.230.0040.00722.08
8.1.220.0040.00417.74
8.1.210.0000.00818.78
8.1.200.0030.00517.23
8.1.190.0030.00617.38
8.1.180.0040.00418.10
8.1.170.0070.00320.36
8.1.160.0000.00718.96
8.1.150.0040.00420.29
8.1.140.0050.00317.46
8.1.130.0070.00017.85
8.1.120.0070.00017.39
8.1.110.0000.00717.37
8.1.100.0040.00417.54
8.1.90.0050.00317.47
8.1.80.0000.00717.37
8.1.70.0040.00417.31
8.1.60.0080.00017.48
8.1.50.0040.00417.52
8.1.40.0060.00317.48
8.1.30.0030.00517.57
8.1.20.0030.00517.61
8.1.10.0000.00817.55
8.1.00.0000.00817.48
8.0.300.0040.00419.89
8.0.290.0000.00916.75
8.0.280.0030.00318.33
8.0.270.0080.00017.19
8.0.260.0060.00316.98
8.0.250.0070.00017.00
8.0.240.0060.00316.90
8.0.230.0000.00716.86
8.0.220.0000.00716.96
8.0.210.0000.00716.88
8.0.200.0040.00416.93
8.0.190.0040.00416.85
8.0.180.0030.00316.94
8.0.170.0040.00416.93
8.0.160.0070.00016.96
8.0.150.0060.00316.94
8.0.140.0000.00716.84
8.0.130.0040.00413.40
8.0.120.0080.00016.79
8.0.110.0050.00217.02
8.0.100.0040.00416.95
8.0.90.0040.00416.84
8.0.80.0060.01017.03
8.0.70.0030.00616.84
8.0.60.0080.00017.05
8.0.50.0050.00216.96
8.0.30.0120.00616.98
8.0.20.0140.00517.40
8.0.10.0040.00416.96
8.0.00.0140.00716.83
7.4.330.0050.00016.77
7.4.320.0000.00716.60
7.4.300.0030.00316.49
7.4.290.0000.00716.43
7.4.280.0070.00016.50
7.4.270.0070.00016.54
7.4.260.0030.00316.52
7.4.250.0030.00616.42
7.4.240.0050.00216.47
7.4.230.0040.00416.61
7.4.220.0100.01716.61
7.4.210.0070.00716.64
7.4.200.0030.00316.40
7.4.190.0030.00516.61
7.4.160.0100.00616.63
7.4.150.0090.00917.40
7.4.140.0100.00717.86
7.4.130.0110.00516.55
7.4.120.0070.01016.51
7.4.110.0100.00716.45
7.4.100.0070.01316.49
7.4.90.0160.01016.56
7.4.80.0100.00719.39
7.4.70.0130.00316.55
7.4.60.0070.01116.54
7.4.50.0040.00416.59
7.4.40.0070.01022.77
7.4.30.0150.00416.66
7.4.00.0090.00615.18
7.3.330.0050.00013.26
7.3.320.0020.00513.24
7.3.310.0000.00716.27
7.3.300.0030.00316.24
7.3.290.0090.00616.30
7.3.280.0110.00516.36
7.3.270.0090.00917.40
7.3.260.0100.01218.24
7.3.250.0140.00516.44
7.3.240.0130.00616.47
7.3.230.0090.00916.39
7.3.210.0070.01016.54
7.3.200.0060.01619.39
7.3.190.0000.01816.46
7.3.180.0130.00316.46
7.3.170.0090.01316.64
7.3.160.0090.00916.57
7.3.120.0030.01314.83
7.3.10.0120.00316.59
7.3.00.0080.00516.31
7.2.330.0030.01516.88
7.2.320.0040.01216.78
7.2.310.0090.00916.49
7.2.300.0130.00616.89
7.2.290.0110.00616.68
7.2.130.0040.01216.99
7.2.120.0110.00316.92
7.2.110.0070.00316.64
7.2.100.0060.00617.07
7.2.90.0100.00716.93
7.2.80.0140.00416.80
7.2.70.0030.01417.19
7.2.60.0040.00916.84
7.2.50.0070.01016.88
7.2.40.0040.00817.11
7.2.30.0110.00416.90
7.2.20.0030.01017.13
7.2.10.0060.00616.95
7.2.00.0040.01018.15
7.1.250.0080.00315.85
7.1.240.0070.00715.54
7.1.230.0060.00915.39
7.1.220.0110.00415.39
7.1.210.0030.01315.84
7.1.200.0030.00615.60
7.1.190.0000.01415.76
7.1.180.0000.01415.76
7.1.170.0090.00015.51
7.1.160.0070.00715.87
7.1.150.0000.01315.73
7.1.140.0030.00615.64
7.1.130.0060.00915.79
7.1.120.0000.01515.46
7.1.110.0000.00915.67
7.1.100.0060.00816.84
7.1.90.0160.00016.00
7.1.80.0000.01415.86
7.1.70.0040.00716.34
7.1.60.0080.00817.53
7.1.50.0060.01316.37
7.1.40.0060.00615.96
7.1.30.0030.00615.70
7.1.20.0060.01016.03
7.1.10.0060.00615.83
7.1.00.0050.03019.09
7.0.330.0100.00315.33
7.0.320.0080.00015.40
7.0.310.0030.01415.22
7.0.300.0000.01315.44
7.0.290.0090.00615.14
7.0.280.0000.01415.27
7.0.270.0030.00715.17
7.0.260.0000.01415.50
7.0.250.0070.00715.64
7.0.240.0040.00715.33
7.0.230.0060.00315.37
7.0.220.0030.00615.37
7.0.210.0140.00015.47
7.0.200.0220.00715.14
7.0.190.0000.01015.27
7.0.180.0060.00315.35
7.0.170.0090.00315.39
7.0.160.0030.00915.23
7.0.150.0030.00615.16
7.0.140.0030.04318.85
7.0.130.0060.00615.14
7.0.120.0030.01015.07
7.0.110.0030.01015.38
7.0.100.0080.03817.67
7.0.90.0100.03217.69
7.0.80.0060.04617.60
7.0.70.0180.03817.73
7.0.60.0120.04417.76
7.0.50.0200.02717.90
7.0.40.0130.04316.86
7.0.30.0050.04316.79
7.0.20.0070.04516.71
7.0.10.0030.03316.84
7.0.00.0080.04616.77
5.6.380.0040.01114.48
5.6.370.0060.00314.10
5.6.360.0040.00814.71
5.6.350.0060.00314.36
5.6.340.0030.01014.32
5.6.330.0110.00414.36
5.6.320.0070.00714.75
5.6.310.0030.01014.50
5.6.300.0000.01614.22
5.6.290.0110.00414.32
5.6.280.0070.03717.75
5.6.270.0060.00614.43
5.6.260.0060.01014.34
5.6.250.0070.04117.35
5.6.240.0060.04417.62
5.6.230.0080.04517.44
5.6.220.0070.03617.52
5.6.210.0040.04617.47
5.6.200.0120.03817.74
5.6.190.0110.04317.72
5.6.180.0080.04417.69
5.6.170.0060.04117.73
5.6.160.0080.04217.58
5.6.150.0050.04817.56
5.6.140.0120.03517.62
5.6.130.0150.03317.79
5.6.120.0060.04817.88
5.6.110.0150.03117.78
5.6.100.0030.03117.84
5.6.90.0100.04017.54
5.6.80.0060.03817.41
5.6.70.0020.03017.22
5.6.60.0070.04317.38
5.6.50.0070.02317.53
5.6.40.0060.02317.37
5.6.30.0060.03817.30
5.6.20.0030.04917.23
5.6.10.0030.03917.38
5.6.00.0050.03617.46
5.5.380.0060.04515.84
5.5.370.0060.04515.83
5.5.360.0070.04315.89
5.5.350.0140.03815.77
5.5.340.0100.03316.11
5.5.330.0070.03716.06
5.5.320.0080.04015.94
5.5.310.0030.04016.11
5.5.300.0080.02316.16
5.5.290.0060.04616.03
5.5.280.0060.02516.11
5.5.270.0020.04816.09
5.5.260.0110.03516.04
5.5.250.0020.03915.92
5.5.240.0050.04115.71
5.5.230.0080.03615.63
5.5.220.0050.04615.54
5.5.210.0020.04715.52
5.5.200.0090.04015.76
5.5.190.0050.04515.71
5.5.180.0070.03515.78
5.5.170.0070.00311.29
5.5.160.0070.02815.66
5.5.150.0060.02215.60
5.5.140.0070.02015.60
5.5.130.0040.04315.68
5.5.120.0050.02815.60
5.5.110.0060.04315.78
5.5.100.0020.02615.54
5.5.90.0100.03715.58
5.5.80.0090.02315.57
5.5.70.0080.02715.56
5.5.60.0050.02515.59
5.5.50.0030.02615.67
5.5.40.0060.02015.53
5.5.30.0030.04615.44
5.5.20.0070.04215.69
5.5.10.0050.04515.63
5.5.00.0030.02515.50
5.4.450.0050.04415.36
5.4.440.0070.04015.09
5.4.430.0070.03815.35
5.4.420.0080.04015.26
5.4.410.0100.03515.21
5.4.400.0120.03314.91
5.4.390.0050.04415.17
5.4.380.0060.04115.06
5.4.370.0050.03815.11
5.4.360.0080.03715.25
5.4.350.0070.03515.02
5.4.340.0030.03414.93
5.4.330.0000.01111.26
5.4.320.0100.04014.87
5.4.310.0080.03614.91
5.4.300.0070.04215.07
5.4.290.0100.02815.02
5.4.280.0090.03215.00
5.4.270.0030.04314.94
5.4.260.0080.03815.03
5.4.250.0100.03314.94
5.4.240.0030.02615.20
5.4.230.0070.02315.27
5.4.220.0140.03314.90
5.4.210.0050.03715.12
5.4.200.0050.02814.93
5.4.190.0000.04914.98
5.4.180.0070.03415.11
5.4.170.0130.02615.03
5.4.160.0050.03914.97
5.4.150.0040.04715.13
5.4.140.0050.03313.52
5.4.130.0070.03913.63
5.4.120.0040.04413.65
5.4.110.0050.02713.55
5.4.100.0030.02613.71
5.4.90.0070.02313.80
5.4.80.0050.03813.77
5.4.70.0050.02913.78
5.4.60.0080.03813.67
5.4.50.0080.01713.71
5.4.40.0030.04313.88
5.4.30.0110.02813.81
5.4.20.0100.02813.80
5.4.10.0050.04213.83
5.4.00.0060.02513.46
5.3.290.0050.04112.71
5.3.280.0070.04012.55
5.3.270.0030.04012.55
5.3.260.0050.03212.68
5.3.250.0070.03212.62
5.3.240.0110.03312.52
5.3.230.0030.04812.63
5.3.220.0020.03112.56
5.3.210.0050.04012.53
5.3.200.0050.03312.49
5.3.190.0070.03812.58
5.3.180.0090.03912.63
5.3.170.0100.03712.65
5.3.160.0060.01812.71
5.3.150.0080.01812.68
5.3.140.0170.01712.58
5.3.130.0030.04112.46
5.3.120.0040.04512.40
5.3.110.0030.03512.56
5.3.100.0020.04112.36
5.3.90.0060.04012.24
5.3.80.0020.03512.22
5.3.70.0080.03412.35
5.3.60.0100.03712.33
5.3.50.0020.04212.29
5.3.40.0060.03612.28
5.3.30.0040.04212.22
5.3.20.0060.02712.20
5.3.10.0050.04111.99
5.3.00.0070.02211.97
5.2.170.0050.02110.73
5.2.160.0050.03310.75
5.2.150.0020.03210.75
5.2.140.0050.03310.66
5.2.130.0030.03210.67
5.2.120.0040.03310.69
5.2.110.0070.01810.65
5.2.100.0020.03510.73
5.2.90.0030.03310.70
5.2.80.0030.02310.64
5.2.70.0070.02610.71
5.2.60.0030.03610.65
5.2.50.0050.02310.70
5.2.40.0070.03310.64
5.2.30.0040.02410.63
5.2.20.0000.03610.54
5.2.10.0060.02110.61
5.2.00.0030.03110.50
5.1.60.0060.02010.16
5.1.50.0060.01510.12
5.1.40.0100.01810.06
5.1.30.0030.03310.31
5.1.20.0050.01610.33
5.1.10.0060.01410.09
5.1.00.0050.01510.23
5.0.50.0020.0229.52
5.0.40.0020.0179.52
5.0.30.0040.0259.52
5.0.20.0010.0139.52
5.0.10.0030.0139.52
5.0.00.0040.0169.52
4.4.90.0020.0119.52
4.4.80.0050.0089.52
4.4.70.0020.0209.52
4.4.60.0030.0149.52
4.4.50.0020.0209.52
4.4.40.0020.0189.52
4.4.30.0020.0189.52
4.4.20.0020.0159.52
4.4.10.0030.0209.52
4.4.00.0000.0279.52
4.3.110.0020.0219.52
4.3.100.0000.0179.52
4.3.90.0020.0109.52
4.3.80.0000.0279.52
4.3.70.0000.0109.52
4.3.60.0030.0199.52
4.3.50.0030.0209.52
4.3.40.0000.0209.52
4.3.30.0020.0189.52
4.3.20.0040.0189.52
4.3.10.0050.0159.52
4.3.00.0020.0129.52

preferences:
56.14 ms | 401 KiB | 5 Q