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) { $value = $this->filter($value); } } $array = array( ' string 1 ', 'string 2', 'string 3 ', ); foreach (new CallbackFilterIterator(new ArrayIterator($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.60.0090.00916.50
8.3.50.0130.00522.93
8.3.40.0040.01118.70
8.3.30.0100.00319.08
8.3.20.0040.00420.16
8.3.10.0080.00023.66
8.3.00.0040.00419.25
8.2.180.0120.00616.63
8.2.170.0040.01522.96
8.2.160.0100.00320.38
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0140.00326.16
8.2.120.0040.00420.86
8.2.110.0060.00322.11
8.2.100.0040.00818.03
8.2.90.0000.00819.11
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0030.00618.05
8.2.50.0000.00918.07
8.2.40.0000.00819.89
8.2.30.0040.00417.94
8.2.20.0000.00817.73
8.2.10.0000.00718.21
8.2.00.0070.00317.81
8.1.280.0100.00725.92
8.1.270.0060.00323.79
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00324.03
8.1.230.0040.00819.16
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0100.00017.35
8.1.190.0000.00817.25
8.1.180.0030.00518.10
8.1.170.0030.00518.66
8.1.160.0040.00422.01
8.1.150.0100.00018.90
8.1.140.0000.00717.44
8.1.130.0030.00517.76
8.1.120.0040.00417.39
8.1.110.0040.00417.43
8.1.100.0000.00717.44
8.1.90.0040.00417.45
8.1.80.0040.00317.48
8.1.70.0030.00317.36
8.1.60.0000.00917.59
8.1.50.0000.00917.42
8.1.40.0020.00517.53
8.1.30.0000.00817.63
8.1.20.0000.00817.66
8.1.10.0030.00617.51
8.1.00.0000.00817.42
8.0.300.0070.00018.77
8.0.290.0000.00816.88
8.0.280.0040.00418.44
8.0.270.0030.00317.27
8.0.260.0030.00317.25
8.0.250.0070.00016.97
8.0.240.0000.00716.99
8.0.230.0000.00716.86
8.0.220.0030.00316.87
8.0.210.0000.00716.86
8.0.200.0040.00417.04
8.0.190.0070.00017.02
8.0.180.0070.00016.87
8.0.170.0040.00416.98
8.0.160.0000.00716.91
8.0.150.0070.00016.91
8.0.140.0000.01016.81
8.0.130.0050.00013.42
8.0.120.0070.00016.90
8.0.110.0040.00416.82
8.0.100.0000.00716.96
8.0.90.0040.00316.83
8.0.80.0100.01016.87
8.0.70.0090.00017.02
8.0.60.0000.00716.81
8.0.50.0040.00416.96
8.0.30.0120.01116.95
8.0.20.0080.01117.40
8.0.10.0030.00517.08
8.0.00.0100.00716.69
7.4.330.0000.00515.14
7.4.320.0000.00816.59
7.4.300.0000.00716.56
7.4.290.0000.00716.61
7.4.280.0040.00416.57
7.4.270.0000.00716.61
7.4.260.0000.00716.63
7.4.250.0040.00416.32
7.4.240.0040.00316.49
7.4.230.0040.00416.39
7.4.220.0070.01016.54
7.4.210.0040.01116.45
7.4.200.0000.00816.50
7.4.160.0060.01516.66
7.4.150.0120.00917.40
7.4.140.0100.00717.86
7.4.130.0080.00816.54
7.4.120.0090.00916.55
7.4.110.0080.00816.48
7.4.100.0030.01316.47
7.4.90.0040.01216.55
7.4.80.0140.00319.39
7.4.70.0100.01316.59
7.4.60.0100.00716.57
7.4.50.0080.00016.50
7.4.40.0100.00716.39
7.4.30.0100.00716.57
7.4.00.0030.01214.90
7.3.330.0020.00213.25
7.3.320.0050.00013.17
7.3.310.0030.00316.29
7.3.300.0040.00416.19
7.3.290.0040.01516.24
7.3.280.0050.00916.22
7.3.270.0150.00917.40
7.3.260.0140.00416.29
7.3.250.0110.00716.40
7.3.240.0070.01016.46
7.3.230.0090.00616.48
7.3.210.0080.00816.38
7.3.200.0120.00419.39
7.3.190.0060.00916.50
7.3.180.0130.00616.36
7.3.170.0030.01716.49
7.3.160.0110.00616.43
7.3.10.0180.00916.09
7.3.00.0120.00916.03
7.2.330.0110.00716.67
7.2.320.0030.01316.41
7.2.310.0110.01216.84
7.2.300.0100.00716.64
7.2.290.0110.01116.43
7.2.130.0170.00716.79
7.2.120.0160.00616.39
7.2.110.0170.01316.92
7.2.100.0140.00516.50
7.2.90.0050.01416.59
7.2.80.0180.00116.56
7.2.70.0130.01017.03
7.2.60.0000.01016.47
7.2.50.0150.00316.94
7.2.40.0130.00316.48
7.2.30.0120.00416.37
7.2.20.0160.00316.63
7.2.10.0120.00616.34
7.2.00.0070.00918.02
7.1.250.0140.00715.38
7.1.100.0030.01017.96
7.1.70.0030.01317.03
7.1.60.0130.00319.40
7.1.50.0030.01016.66
7.1.00.0030.07722.27
7.0.200.0030.00716.94
7.0.140.0000.07722.08
7.0.60.0100.08019.87
7.0.50.0130.05017.87
7.0.40.0000.06320.09
7.0.30.0170.05320.24
7.0.20.0200.08320.21
7.0.10.0100.08320.21
7.0.00.0070.04720.44
5.6.280.0070.07021.10
5.6.210.0100.07720.46
5.6.200.0000.07318.25
5.6.190.0070.05020.39
5.6.180.0330.07020.77
5.6.170.0230.04020.55
5.6.160.0030.05020.50
5.6.150.0030.05718.23
5.6.140.0030.08018.28
5.6.130.0100.04718.25
5.6.120.0200.07320.99
5.6.110.0100.08321.14
5.6.100.0100.04021.14
5.6.90.0070.06321.12
5.6.80.0030.04720.53
5.5.350.0000.04320.39
5.5.340.0100.05018.00
5.5.330.0070.08320.21
5.5.320.0070.08020.27
5.5.310.0170.06020.30
5.5.300.0100.07717.98
5.5.290.0170.07018.08
5.5.280.0100.08020.77
5.5.270.0170.07320.86
5.5.260.0030.08720.87
5.5.250.0000.04320.59
5.5.240.4170.03720.36
5.4.450.0430.04019.52
5.4.440.0170.05019.32
5.4.430.0300.04019.32
5.4.420.0200.04719.32
5.4.410.0270.04319.44
5.4.400.0530.04319.15
5.4.390.0900.04719.22
5.4.380.0100.05718.63
5.4.370.0130.05318.61
5.4.360.0070.06018.76
5.4.350.0230.04718.65
5.4.340.0170.05318.77
5.4.320.0100.03312.50
5.4.310.0070.04112.50
5.4.300.0050.03712.50
5.4.290.0050.04012.50
5.4.280.0070.03412.39
5.4.270.0070.03512.40
5.4.260.0050.03912.40
5.4.250.0080.03612.39
5.4.240.0070.03612.39
5.4.230.0050.04212.39
5.4.220.0030.03812.39
5.4.210.0060.04112.39
5.4.200.0060.03712.39
5.4.190.0020.04012.39
5.4.180.0100.03312.39
5.4.170.0090.03512.40
5.4.160.0070.03812.40
5.4.150.0050.03812.39
5.4.140.0050.03812.07
5.4.130.0070.03412.06
5.4.120.0050.03612.02
5.4.110.0060.03512.02
5.4.100.0060.03712.02
5.4.90.0040.04012.01
5.4.80.0090.03512.02
5.4.70.0060.04112.02
5.4.60.0050.04012.01
5.4.50.0120.03112.01
5.4.40.0070.04512.00
5.4.30.0060.03712.00
5.4.20.0060.03511.99
5.4.10.0060.04411.99
5.4.00.0060.03911.49
5.3.290.0060.04612.80
5.3.280.0090.03512.71
5.3.270.0060.04012.73
5.3.260.0090.05712.72
5.3.250.0060.05012.72
5.3.240.0070.03912.72
5.3.230.0060.04312.71
5.3.220.0080.03812.68
5.3.210.0070.03912.68
5.3.200.0080.03612.68
5.3.190.0030.04212.68
5.3.180.0100.03712.67
5.3.170.0040.04112.67
5.3.160.0070.04112.67
5.3.150.0070.04012.67
5.3.140.0070.03612.66
5.3.130.0020.04212.66
5.3.120.0070.03812.66
5.3.110.0090.03512.66
5.3.100.0050.03812.13
5.3.90.0050.03712.11
5.3.80.0060.04412.10
5.3.70.0070.03712.10
5.3.60.0100.04512.08
5.3.50.0080.04012.04
5.3.40.0080.03812.04
5.3.30.0030.04011.99
5.3.20.0100.04011.77
5.3.10.0060.03611.73
5.3.00.0030.04011.73
5.2.170.0040.0339.23
5.2.160.0030.0319.23
5.2.150.0040.0319.23
5.2.140.0050.0309.23
5.2.130.0030.0309.19
5.2.120.0030.0299.18
5.2.110.0030.0309.20
5.2.100.0080.0259.19
5.2.90.0030.0309.19
5.2.80.0020.0329.18
5.2.70.0040.0389.19
5.2.60.0040.0329.14
5.2.50.0050.0309.10
5.2.40.0070.0339.08
5.2.30.0050.0299.06
5.2.20.0050.0299.05
5.2.10.0070.0268.95
5.2.00.0040.0308.82
5.1.60.0030.0268.09
5.1.50.0030.0258.09
5.1.40.0050.0298.08
5.1.30.0050.0288.43
5.1.20.0030.0338.45
5.1.10.0050.0258.17
5.1.00.0070.0248.17
5.0.50.0030.0216.65
5.0.40.0040.0196.51
5.0.30.0040.0306.33
5.0.20.0010.0246.29
5.0.10.0050.0226.26
5.0.00.0050.0326.25
4.4.90.0030.0154.78
4.4.80.0040.0144.76
4.4.70.0030.0154.75
4.4.60.0030.0154.75
4.4.50.0020.0164.77
4.4.40.0050.0224.71
4.4.30.0040.0144.76
4.4.20.0020.0164.85
4.4.10.0010.0174.85
4.4.00.0020.0254.76
4.3.110.0030.0164.66
4.3.100.0030.0154.67
4.3.90.0010.0234.63
4.3.80.0020.0284.59
4.3.70.0040.0164.63
4.3.60.0000.0174.63
4.3.50.0030.0154.63
4.3.40.0050.0224.54
4.3.30.0030.0153.28
4.3.20.0020.0183.26
4.3.10.0010.0193.22
4.3.00.0130.02013.25

preferences:
42.08 ms | 401 KiB | 5 Q