3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FilterInterface { public function filter($value); } class StringTrimFilter implements FilterInterface { public function filter($value) { return trim($value); } public function __invoke($value) { return $this->filter($value); } } $array = array( ' string 1 ', 'string 2', 'string 3 ', ); foreach (new CallbackFilterIterator($array, new StringTrimFilter()) as $value) { var_dump($value); }

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.40.0120.00318.68
8.3.30.0070.00719.12
8.3.20.0040.00420.33
8.3.10.0080.00023.51
8.3.00.0040.00419.36
8.2.170.0040.01122.96
8.2.160.0110.00420.30
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0110.00626.16
8.2.120.0050.00320.86
8.2.110.0060.00322.14
8.2.100.0060.00618.16
8.2.90.0000.00819.07
8.2.80.0000.00817.97
8.2.70.0080.00017.50
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0000.00718.16
8.2.30.0000.00717.98
8.2.20.0030.00517.80
8.2.10.0000.00717.98
8.2.00.0040.00417.75
8.1.270.0030.00623.79
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00423.96
8.1.230.0000.01119.16
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0080.00017.36
8.1.180.0000.00818.10
8.1.170.0030.00618.64
8.1.160.0060.00322.03
8.1.150.0070.00318.97
8.1.140.0000.00717.42
8.1.130.0000.00717.85
8.1.120.0000.00717.48
8.1.110.0040.00417.44
8.1.100.0000.00717.52
8.1.90.0040.00417.41
8.1.80.0000.00717.43
8.1.70.0030.00317.39
8.1.60.0090.00017.53
8.1.50.0030.00617.57
8.1.40.0000.00817.54
8.1.30.0080.00017.69
8.1.20.0030.00617.60
8.1.10.0020.00517.48
8.1.00.0030.00617.54
8.0.300.0070.00018.77
8.0.290.0030.00616.75
8.0.280.0070.00018.38
8.0.270.0040.00416.90
8.0.260.0000.00617.12
8.0.250.0050.00217.02
8.0.240.0070.00017.08
8.0.230.0000.00717.02
8.0.220.0030.00516.96
8.0.210.0080.00017.00
8.0.200.0050.00216.90
8.0.190.0000.00717.07
8.0.180.0000.00716.86
8.0.170.0040.00416.90
8.0.160.0000.00717.01
8.0.150.0000.00716.87
8.0.140.0040.00716.82
8.0.130.0000.00613.36
8.0.120.0040.00416.95
8.0.110.0080.00016.88
8.0.100.0070.00017.04
8.0.90.0070.00017.01
8.0.80.0060.00916.92
8.0.70.0000.00716.94
8.0.60.0000.00916.95
8.0.50.0050.00216.97
8.0.30.0100.01117.17
8.0.20.0140.01017.42
8.0.10.0000.00817.14
8.0.00.0070.01016.94
7.4.330.0050.00015.00
7.4.320.0000.00616.63
7.4.300.0030.00316.51
7.4.290.0000.00716.51
7.4.280.0070.00016.64
7.4.270.0070.00016.45
7.4.260.0030.00313.34
7.4.250.0040.00416.63
7.4.240.0050.00316.62
7.4.230.0000.00716.62
7.4.220.0120.00616.45
7.4.210.0080.00916.59
7.4.200.0040.00416.62
7.4.160.0070.01016.45
7.4.150.0070.01117.40
7.4.140.0120.00517.86
7.4.130.0130.00316.61
7.4.120.0120.00616.59
7.4.110.0140.00416.51
7.4.100.0100.00716.59
7.4.90.0170.00016.54
7.4.80.0110.00919.39
7.4.70.0150.00316.66
7.4.60.0070.01116.44
7.4.50.0080.00016.59
7.4.40.0100.00616.52
7.4.30.0080.00816.66
7.4.00.0030.00914.77
7.3.330.0000.00613.32
7.3.320.0030.00313.25
7.3.310.0070.00016.21
7.3.300.0040.00416.26
7.3.290.0070.00716.27
7.3.280.0060.01016.31
7.3.270.0090.00917.40
7.3.260.0060.01316.46
7.3.250.0080.00816.52
7.3.240.0030.01316.23
7.3.230.0090.00916.39
7.3.210.0160.00316.48
7.3.200.0090.01219.39
7.3.190.0030.01316.26
7.3.180.0030.01316.36
7.3.170.0100.01316.37
7.3.160.0100.00616.44
7.3.10.0080.01216.59
7.3.00.0110.00416.65
7.2.330.0000.01816.41
7.2.320.0130.00316.43
7.2.310.0090.00916.58
7.2.300.0090.00916.74
7.2.290.0000.02216.47
7.2.130.0100.01016.47
7.2.120.0090.00416.66
7.2.110.0070.01316.47
7.2.100.0100.01016.33
7.2.90.0130.00616.18
7.2.80.0150.00416.70
7.2.70.0130.00616.50
7.2.60.0080.00716.67
7.2.50.0200.00316.65
7.2.40.0260.00016.64
7.2.30.0160.00616.50
7.2.20.0110.01416.72
7.2.10.0160.00616.39
7.2.00.0110.00518.05
7.1.250.0090.00615.54
7.1.200.0050.00215.62
7.1.100.0250.00617.03
7.1.70.0060.00317.00
7.1.60.0120.01219.40
7.1.50.0070.01316.86
7.1.00.0100.07322.51
7.0.200.0090.00016.89
7.0.140.0030.07322.08
7.0.60.0000.06719.90
7.0.50.0170.05017.88
7.0.40.0070.04320.09
7.0.30.0230.06020.21
7.0.20.0170.04020.06
7.0.10.0000.05020.15
7.0.00.0030.08020.25
5.6.280.0100.06721.00
5.6.210.0100.07320.57
5.6.200.0000.06318.22
5.6.190.0100.04720.65
5.6.180.0230.08720.67
5.6.170.0200.03720.71
5.6.160.0000.04320.55
5.6.150.0000.04318.23
5.6.140.0070.03718.29
5.6.130.0070.05318.28
5.6.120.0070.06721.02
5.6.110.0130.08020.96
5.6.100.0030.06320.96
5.6.90.0100.07021.00
5.6.80.0030.04020.35
5.5.350.0030.07020.41
5.5.340.0000.05017.98
5.5.330.0100.07320.25
5.5.320.0330.05320.30
5.5.310.0300.07720.35
5.5.300.0030.08018.07
5.5.290.0030.07717.95
5.5.280.0100.07720.88
5.5.270.0100.08320.68
5.5.260.0030.07020.79
5.5.250.0000.05020.59
5.5.240.4170.04020.08
5.4.450.0100.05019.64
5.4.440.0230.04019.57
5.4.430.0570.04019.27
5.4.420.0330.04319.16
5.4.410.0400.04319.26
5.4.400.0670.03319.15
5.4.390.1170.03019.09
5.4.380.0270.04318.66
5.4.370.0230.04718.72
5.4.360.0130.05318.69
5.4.350.0200.07018.72
5.4.340.0100.05718.68
5.4.320.0080.04012.50
5.4.310.0080.04312.50
5.4.300.0000.04412.50
5.4.290.0060.03912.50
5.4.280.0090.04012.40
5.4.270.0100.03612.39
5.4.260.0080.04412.40
5.4.250.0040.03912.40
5.4.240.0060.03812.40
5.4.230.0090.03812.39
5.4.220.0060.03912.39
5.4.210.0040.03912.39
5.4.200.0060.03912.39
5.4.190.0060.03912.39
5.4.180.0070.03912.39
5.4.170.0090.03412.40
5.4.160.0050.03612.40
5.4.150.0030.03912.39
5.4.140.0050.03812.07
5.4.130.0090.03612.06
5.4.120.0090.04612.02
5.4.110.0050.03712.02
5.4.100.0090.03612.01
5.4.90.0090.03612.02
5.4.80.0040.04012.02
5.4.70.0050.03712.01
5.4.60.0080.03312.02
5.4.50.0100.03212.01
5.4.40.0070.03412.00
5.4.30.0080.03412.00
5.4.20.0080.03512.00
5.4.10.0080.03312.00
5.4.00.0050.03711.49
5.3.290.0070.04612.80
5.3.280.0070.03712.71
5.3.270.0060.04112.72
5.3.260.0070.03712.71
5.3.250.0060.03712.72
5.3.240.0060.04012.72
5.3.230.0060.03812.71
5.3.220.0060.03712.68
5.3.210.0090.03712.68
5.3.200.0080.03412.68
5.3.190.0050.03812.68
5.3.180.0060.03612.68
5.3.170.0050.03812.66
5.3.160.0050.03612.67
5.3.150.0080.03512.67
5.3.140.0090.03612.66
5.3.130.0070.03912.66
5.3.120.0040.04112.66
5.3.110.0040.04212.66
5.3.100.0060.03612.12
5.3.90.0060.03712.11
5.3.80.0060.03512.10
5.3.70.0080.03412.10
5.3.60.0040.03812.09
5.3.50.0070.03512.04
5.3.40.0030.03812.04
5.3.30.0040.03711.99
5.3.20.0050.03911.77
5.3.10.0050.03511.74
5.3.00.0020.04011.73
5.2.170.0090.0309.23
5.2.160.0030.0379.23
5.2.150.0050.0299.23
5.2.140.0040.0319.23
5.2.130.0020.0329.19
5.2.120.0040.0289.19
5.2.110.0080.0359.20
5.2.100.0060.0409.19
5.2.90.0020.0319.19
5.2.80.0050.0319.19
5.2.70.0070.0299.18
5.2.60.0050.0299.13
5.2.50.0060.0339.10
5.2.40.0070.0299.08
5.2.30.0050.0319.06
5.2.20.0050.0299.04
5.2.10.0060.0278.95
5.2.00.0050.0298.82
5.1.60.0020.0338.10
5.1.50.0070.0228.09
5.1.40.0070.0238.08
5.1.30.0040.0278.43
5.1.20.0040.0308.45
5.1.10.0050.0258.17
5.1.00.0050.0258.17
5.0.50.0040.0216.65
5.0.40.0020.0226.50
5.0.30.0050.0316.32
5.0.20.0010.0216.29
5.0.10.0050.0186.26
5.0.00.0050.0376.25
4.4.90.0050.0174.78
4.4.80.0020.0174.76
4.4.70.0030.0154.76
4.4.60.0030.0154.75
4.4.50.0010.0164.77
4.4.40.0030.0254.70
4.4.30.0070.0174.75
4.4.20.0030.0174.85
4.4.10.0030.0184.85
4.4.00.0030.0264.76
4.3.110.0020.0174.67
4.3.100.0060.0134.67
4.3.90.0040.0154.63
4.3.80.0000.0284.58
4.3.70.0020.0194.63
4.3.60.0010.0174.63
4.3.50.0050.0184.63
4.3.40.0020.0274.54
4.3.30.0000.0213.28
4.3.20.0010.0183.26
4.3.10.0010.0203.22
4.3.00.0070.01713.25

preferences:
43.87 ms | 400 KiB | 5 Q