3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array( ' hello ','whsdf ',' lve you',' '); $input2 = array( ' hello ','whsdf ',' lve you',' '); $input3 = array( ' hello ','whsdf ',' lve you',' '); $time_start = microtime(true); $input = array_map('trim',$input); $time_end = microtime(true); $time = $time_end - $time_start; echo "Did array_map in $time seconds<br>"; foreach($input as $in){ echo "'$in': ".strlen($in)."<br>"; } //////////////////////////////////////////////// $time_start = microtime(true); array_walk($input2,'trim'); $time_end = microtime(true); $time = $time_end - $time_start; echo "Did array_walk in $time seconds<br>"; foreach($input2 as $in){ echo "'$in': ".strlen($in)."<br>"; } //////////////////////////////////////////////// $time_start = microtime(true); foreach($input3 as $in){ $in = trim($in); } $time_end = microtime(true); $time = $time_end - $time_start; echo "Did foreach in $time seconds<br>"; foreach($input3 as $in){ echo "'$in': ".strlen($in)."<br>"; }

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)
7.4.10.0070.01414.85
7.4.00.0030.01215.08
7.3.130.0110.00714.96
7.3.120.0130.00615.07
7.3.110.0100.00615.04
7.3.100.0030.01314.80
7.3.90.0000.01015.07
7.3.80.0000.01315.18
7.3.70.0080.00415.00
7.3.60.0060.00914.69
7.3.50.0040.01114.84
7.3.40.0090.00314.89
7.3.30.0060.00614.83
7.3.20.0090.00616.83
7.3.10.0030.01216.71
7.3.00.0060.00616.39
7.2.260.0040.01114.87
7.2.250.0060.01215.25
7.2.240.0090.00615.24
7.2.230.0100.00615.21
7.2.220.0110.00315.16
7.2.210.0100.00315.23
7.2.200.0060.01015.15
7.2.190.0080.00814.88
7.2.180.0070.00714.90
7.2.170.0000.01415.11
7.2.160.0070.00715.13
7.2.150.0110.00717.09
7.2.140.0130.00616.98
7.2.130.0090.00616.88
7.2.120.0060.00917.05
7.2.110.0080.00416.99
7.2.100.0070.01017.02
7.2.90.0100.00616.88
7.2.80.0060.01017.03
7.2.70.0090.00616.86
7.2.60.0090.00616.81
7.2.50.0110.00417.06
7.2.40.0090.00617.03
7.2.30.0000.01517.09
7.2.20.0050.00516.66
7.2.10.0040.00817.00
7.2.00.0070.00718.21
7.1.330.0000.01415.88
7.1.320.0040.01115.82
7.1.310.0030.01315.45
7.1.300.0090.00615.61
7.1.290.0030.00715.55
7.1.280.0070.00715.80
7.1.270.0080.00515.57
7.1.260.0060.01215.78
7.1.250.0140.00015.78
7.1.240.0040.01115.45
7.1.230.0080.00315.91
7.1.220.0040.01115.91
7.1.210.0110.00315.92
7.1.200.0030.01215.80
7.1.190.0040.01115.90
7.1.180.0100.00716.02
7.1.170.0000.01415.77
7.1.160.0100.00315.89
7.1.150.0000.01315.78
7.1.140.0030.01015.83
7.1.130.0080.00315.78
7.1.120.0040.00815.97
7.1.110.0100.00715.94
7.1.100.0110.00415.91
7.1.90.0070.00715.98
7.1.80.0000.00915.74
7.1.70.0040.00716.39
7.1.60.0050.01517.39
7.1.50.0070.01216.20
7.1.40.0040.01115.71
7.1.30.0040.01115.84
7.1.20.0080.00415.45
7.1.10.0040.01115.77
7.1.00.0040.04018.98
7.0.330.0100.00315.31
7.0.320.0060.00815.12
7.0.310.0070.00715.40
7.0.300.0000.00815.50
7.0.290.0030.01015.43
7.0.280.0030.01215.23
7.0.270.0040.01115.34
7.0.260.0030.00915.04
7.0.250.0070.00715.17
7.0.240.0070.00715.51
7.0.230.0100.00015.56
7.0.220.0060.00615.54
7.0.210.0000.00915.43
7.0.200.0050.00316.08
7.0.190.0080.00415.34
7.0.180.0090.00615.45
7.0.170.0070.00315.52
7.0.160.0060.00615.33
7.0.150.0060.00315.51
7.0.140.0060.03818.78
7.0.130.0060.00915.30
7.0.120.0120.00415.48
7.0.110.0000.01615.39
7.0.100.0060.03818.62
7.0.90.0070.04118.74
7.0.80.0030.04118.71
7.0.70.0030.04918.61
7.0.60.0070.04518.48
7.0.50.0100.02818.92
7.0.40.0040.02516.73
7.0.30.0050.02516.76
7.0.20.0030.02516.77
7.0.10.0050.03116.82
7.0.00.0000.02816.74
5.6.400.0080.00414.26
5.6.390.0060.00614.49
5.6.380.0070.00714.34
5.6.370.0070.00714.61
5.6.360.0060.00914.23
5.6.350.0030.01214.60
5.6.340.0030.00614.67
5.6.330.0100.00314.53
5.6.320.0030.01013.99
5.6.310.0070.00714.46
5.6.300.0090.00614.42
5.6.290.0040.01114.30
5.6.280.0060.03817.63
5.6.270.0030.01314.49
5.6.260.0000.01514.06
5.6.250.0010.04617.60
5.6.240.0050.04317.33
5.6.230.0070.04017.45
5.6.220.0050.04717.33
5.6.210.0100.04117.63
5.6.200.0090.04317.69
5.6.190.0090.04117.61
5.6.180.0050.02517.68
5.6.170.0030.02817.49
5.6.160.0070.02417.83
5.6.150.0030.02517.52
5.6.140.0070.02317.61
5.6.130.0050.03217.82
5.6.120.0020.03117.84
5.6.110.0100.02017.56
5.6.100.0020.02817.73
5.6.90.0030.04217.81
5.6.80.0080.03517.52
5.6.70.0020.03717.28
5.6.60.0020.02717.33
5.6.50.0050.02317.32
5.6.40.0070.01917.34
5.6.30.0050.02317.49
5.6.20.0020.02517.37
5.6.10.0000.03117.35
5.6.00.0030.02417.20
5.5.380.0020.04217.34
5.5.370.0050.04717.49
5.5.360.0030.04517.21
5.5.350.0110.04017.45
5.5.340.0090.04417.56
5.5.330.0050.03717.58
5.5.320.0060.02117.60
5.5.310.0050.02517.54
5.5.300.0050.03017.54
5.5.290.0100.03717.42
5.5.280.0060.02917.68
5.5.270.0020.03717.56
5.5.260.0030.02517.52
5.5.250.0030.02517.33
5.5.240.0050.02317.29
5.5.230.0020.04717.13
5.5.220.0030.02517.20
5.5.210.0050.02417.28
5.5.200.0050.02217.15
5.5.190.0050.02217.02
5.5.180.0060.02817.37
5.5.170.0000.01514.15
5.5.160.0060.02817.25
5.5.150.0080.02817.28
5.5.140.0050.02517.28
5.5.130.0030.04717.22
5.5.120.0070.04416.99
5.5.110.0070.03917.31
5.5.100.0050.04417.00
5.5.90.0050.04317.14
5.5.80.0140.03717.16
5.5.70.0080.03817.07
5.5.60.0080.04117.00
5.5.50.0060.04217.18
5.5.40.0050.04217.17
5.5.30.0110.02917.17
5.5.20.0050.04817.25
5.5.10.0110.03517.17
5.5.00.0020.04617.18
5.4.450.0030.02815.73
5.4.440.0050.03215.73
5.4.430.0020.02815.79
5.4.420.0050.02015.69
5.4.410.0000.03015.56
5.4.400.0020.04515.58
5.4.390.0020.02615.62
5.4.380.0020.02315.57
5.4.370.0060.02215.61
5.4.360.0000.03315.65
5.4.350.0070.02015.54
5.4.340.0050.02215.45
5.4.330.0040.00812.11
5.4.320.0050.02015.61
5.4.310.0010.03715.54
5.4.300.0050.01815.67
5.4.290.0100.03615.44
5.4.280.0030.04315.46
5.4.270.0020.04115.60
5.4.260.0050.03715.50
5.4.250.0050.04115.44
5.4.240.0060.03715.54
5.4.230.0040.04215.44
5.4.220.0030.04515.56
5.4.210.0090.03715.55
5.4.200.0050.03715.50
5.4.190.0060.03815.64
5.4.180.0030.03515.50
5.4.170.0050.02915.56
5.4.160.0000.03715.59
5.4.150.0030.04515.45
5.4.140.0020.04114.19
5.4.130.0050.04014.24
5.4.120.0030.03514.11
5.4.110.0050.04114.21
5.4.100.0050.04314.16
5.4.90.0100.03214.20
5.4.80.0070.04014.26
5.4.70.0050.04014.22
5.4.60.0050.03914.16
5.4.50.0130.02914.15
5.4.40.0030.03814.17
5.4.30.0050.03814.14
5.4.20.0100.03514.17
5.4.10.0050.03714.19
5.4.00.0050.03813.96
5.3.290.0020.04113.39
5.3.280.0070.03713.33
5.3.270.0080.03713.35
5.3.260.0020.03313.35
5.3.250.0050.03813.29
5.3.240.0020.04113.35
5.3.230.0060.04013.34
5.3.220.0070.03813.27
5.3.210.0020.04113.26
5.3.200.0070.03713.34
5.3.190.0120.03913.27
5.3.180.0060.03813.32
5.3.170.0080.04213.28
5.3.160.0050.03813.34
5.3.150.0050.03913.33
5.3.140.0060.02613.34
5.3.130.0070.04213.29
5.3.120.0050.03913.32
5.3.110.0070.02813.26
5.3.100.0080.03813.03
5.3.90.0060.03613.00
5.3.80.0060.03813.04
5.3.70.0050.03213.07
5.3.60.0020.04613.04
5.3.50.0080.03713.01
5.3.40.0050.03813.00
5.3.30.0050.03812.95
5.3.20.0060.03812.89
5.3.10.0070.03412.81
5.3.00.0040.02612.88
5.2.170.0030.04712.07
5.2.160.0100.06012.07
5.2.150.0070.06012.07
5.2.140.0070.06012.07
5.2.130.0030.04012.07
5.2.120.0030.03712.07
5.2.110.0130.05312.07
5.2.100.0000.06312.07
5.2.90.0070.05012.07
5.2.80.0030.06312.07
5.2.70.0130.05312.07
5.2.60.0070.06012.07
5.2.50.0070.05712.07
5.2.40.0030.06312.07
5.2.30.0070.06012.07
5.2.20.0100.05712.07
5.2.10.0130.05012.07
5.2.00.0070.06012.07
5.1.60.0030.05712.07
5.1.50.0030.05712.07
5.1.40.0100.04712.07
5.1.30.0000.06012.07
5.1.20.0070.02712.07
5.1.10.0030.05712.07
5.1.00.0130.05012.07
5.0.50.0030.04712.07
5.0.40.0030.04312.07
5.0.30.0070.06312.07
5.0.20.0000.04312.07
5.0.10.0000.04012.07
5.0.00.0030.06312.07
4.4.90.0070.03012.07
4.4.80.0030.03712.07
4.4.70.0030.03312.07
4.4.60.0030.03312.07
4.4.50.0000.03712.07
4.4.40.0030.05012.07
4.4.30.0000.03712.07
4.4.20.0000.03712.07
4.4.10.0000.03712.07
4.4.00.0000.05712.07
4.3.110.0030.03012.07
4.3.100.0000.03712.07
4.3.90.0000.03712.07
4.3.80.0070.04712.07
4.3.70.0070.03012.07
4.3.60.0030.03712.07
4.3.50.0070.02712.07
4.3.40.0000.04312.07
4.3.30.0030.03312.07
4.3.20.0030.03012.07
4.3.10.0000.03712.07
4.3.00.0000.02712.07

preferences:
44.57 ms | 401 KiB | 5 Q