3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "ABCDE \t\n\r\x0B\f\0"; $array = array(); $array[] = trim($string); $array[] = preg_replace('/\s+/', '', $string); $array[] = preg_replace('/\s\s+/', '', $string); $array[] = trim(preg_replace('/[\s\t\n\r\s]+/', '', $string)); $array[] = preg_replace('/~\x{00a0}~siu/', '', $string); $array[] = str_replace(array(" ", "\t", "\n", "\r", "\x0B", "\f", "\0"), '', $string); var_dump($array);

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.0000.01516.50
8.3.50.0120.00622.81
8.3.40.0090.00618.66
8.3.30.0110.00418.96
8.3.20.0040.00420.25
8.3.10.0090.00023.48
8.3.00.0040.00419.38
8.2.180.0120.00318.66
8.2.170.0140.00322.96
8.2.160.0160.00620.47
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.01121.28
8.2.110.0060.00320.57
8.2.100.0040.00818.05
8.2.90.0000.00819.21
8.2.80.0030.00517.97
8.2.70.0080.00017.75
8.2.60.0050.00318.05
8.2.50.0040.00418.07
8.2.40.0000.00818.09
8.2.30.0000.00719.45
8.2.20.0040.00417.71
8.2.10.0000.00818.00
8.2.00.0080.00017.82
8.1.280.0080.00825.92
8.1.270.0040.00423.93
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00923.84
8.1.230.0040.00818.84
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0050.00317.35
8.1.180.0030.00618.10
8.1.170.0090.00018.62
8.1.160.0050.00321.98
8.1.150.0040.00418.75
8.1.140.0000.00717.52
8.1.130.0000.00717.80
8.1.120.0000.00817.54
8.1.110.0050.00317.44
8.1.100.0050.00317.53
8.1.90.0020.00517.50
8.1.80.0000.00817.55
8.1.70.0040.00417.51
8.1.60.0000.01117.67
8.1.50.0040.00417.61
8.1.40.0040.00417.62
8.1.30.0040.00417.77
8.1.20.0040.00417.80
8.1.10.0050.00317.57
8.1.00.0040.00417.41
8.0.300.0040.00418.77
8.0.290.0040.00416.72
8.0.280.0000.00718.27
8.0.270.0080.00017.12
8.0.260.0060.00017.21
8.0.250.0080.00016.99
8.0.240.0030.00517.05
8.0.230.0000.00716.98
8.0.220.0000.00717.03
8.0.210.0000.00716.86
8.0.200.0000.00617.02
8.0.190.0040.00416.96
8.0.180.0070.00016.87
8.0.170.0000.00816.91
8.0.160.0000.00716.92
8.0.150.0060.00316.95
8.0.140.0040.00416.96
8.0.130.0070.00013.38
8.0.120.0000.00816.92
8.0.110.0000.00816.86
8.0.100.0000.00717.00
8.0.90.0020.00517.03
8.0.80.0090.00617.01
8.0.70.0040.00416.77
8.0.60.0040.00417.00
8.0.50.0000.00716.91
8.0.30.0120.00617.08
8.0.20.0070.01717.40
8.0.10.0070.00017.10
8.0.00.0110.00816.87
7.4.330.0080.00015.00
7.4.320.0000.00616.78
7.4.300.0030.00316.59
7.4.290.0030.00316.73
7.4.280.0000.00716.62
7.4.270.0000.00716.72
7.4.260.0030.00716.59
7.4.250.0040.00416.63
7.4.240.0040.00416.71
7.4.230.0000.00716.72
7.4.220.0090.00916.64
7.4.210.0070.00716.70
7.4.200.0000.00716.84
7.4.160.0190.00616.50
7.4.150.0120.00917.40
7.4.140.0080.01017.86
7.4.130.0130.00716.63
7.4.120.0110.00516.62
7.4.110.0150.00316.71
7.4.100.0090.00916.64
7.4.90.0090.00916.50
7.4.80.0140.00819.39
7.4.70.0090.00916.68
7.4.60.0090.00916.68
7.4.50.0040.00416.45
7.4.40.0080.00816.74
7.4.30.0060.00916.55
7.4.00.0030.01214.93
7.3.330.0050.00013.09
7.3.320.0050.00013.23
7.3.310.0000.00716.21
7.3.300.0070.00016.30
7.3.290.0040.01116.30
7.3.280.0130.00516.35
7.3.270.0130.00517.40
7.3.260.0100.00716.50
7.3.250.0060.01116.73
7.3.240.0090.00916.55
7.3.230.0030.01216.67
7.3.210.0060.01216.52
7.3.200.0120.00619.39
7.3.190.0060.01216.38
7.3.180.0070.00916.52
7.3.170.0090.00616.38
7.3.160.0030.01316.46
7.3.10.0070.00716.69
7.3.00.0000.01516.68
7.2.330.0070.01116.66
7.2.320.0130.00316.64
7.2.310.0110.00716.70
7.2.300.0150.00616.55
7.2.290.0080.00816.59
7.2.130.0100.00616.93
7.2.120.0120.00316.97
7.2.110.0070.00717.00
7.2.100.0170.00016.94
7.2.90.0070.01116.90
7.2.80.0070.00516.92
7.2.70.0060.01017.05
7.2.60.0050.01016.63
7.2.50.0050.01017.02
7.2.40.0070.00717.04
7.2.30.0030.01017.00
7.2.20.0030.01317.13
7.2.10.0050.00816.87
7.2.00.0090.00618.20
7.1.250.0000.01215.98
7.1.200.0040.00816.03
7.1.100.0000.01118.21
7.1.70.0060.00617.39
7.1.60.0150.01119.46
7.1.50.0070.01117.04
7.1.00.0130.06722.47
7.0.200.0060.00617.00
7.0.140.0100.06721.99
7.0.60.0070.04720.00
7.0.50.0030.07317.94
7.0.40.0070.08719.92
7.0.30.0270.07320.19
7.0.20.0170.08020.11
7.0.10.0070.09020.14
7.0.00.0130.08020.01
5.6.280.0100.06720.89
5.6.210.0130.03720.73
5.6.200.0100.08018.22
5.6.190.0100.04020.41
5.6.180.0500.06720.45
5.6.170.0300.04320.52
5.6.160.0070.08020.51
5.6.150.0070.08318.17
5.6.140.0100.05018.15
5.6.130.0100.07018.07
5.6.120.0070.05020.93
5.6.110.0130.07720.95
5.6.100.0100.03720.88
5.6.90.0100.08320.97
5.6.80.0070.05320.48
5.5.350.0230.07020.43
5.5.340.0070.04017.89
5.5.330.0100.03720.21
5.5.320.0030.05320.32
5.5.310.0230.04320.29
5.5.300.0130.07317.95
5.5.290.0030.06317.86
5.5.280.0070.08320.87
5.5.270.0030.04320.75
5.5.260.0100.05020.84
5.5.250.0030.05320.70
5.5.240.0170.08020.12
5.4.450.1970.04019.11
5.4.440.1900.03719.42
5.4.430.2200.04319.40
5.4.420.1930.04319.58
5.4.410.2100.03719.28
5.4.400.2400.04718.92
5.4.390.2000.03318.92
5.4.380.2770.03319.24
5.4.370.1970.03019.16
5.4.360.2030.03719.09
5.4.350.2130.04318.81
5.4.340.2070.04318.90
5.4.320.2200.04018.81
5.4.310.2070.04318.78
5.4.300.1770.04019.08
5.4.290.0100.03019.08
5.4.280.0030.04019.23
5.4.270.0070.05318.91
5.4.260.1570.04319.09
5.4.250.2070.04019.21
5.4.240.1900.03319.07
5.4.230.1830.04019.05
5.4.220.1800.04319.08
5.4.210.2130.03718.88
5.4.200.2030.04019.24
5.4.190.2100.04318.92
5.4.180.1970.04019.14
5.4.170.2170.04019.09
5.4.160.2130.04019.04
5.4.150.2100.04719.23
5.4.140.1870.03716.42
5.4.130.2200.04016.37
5.4.120.2300.04716.32
5.4.110.2200.04016.12
5.4.100.2070.04716.28
5.4.90.2170.03316.12
5.4.80.2130.04016.47
5.4.70.2200.03316.53
5.4.60.1900.03016.36
5.4.50.2130.04316.33
5.4.40.2000.04316.36
5.4.30.2070.03716.36
5.4.20.2300.04016.04
5.4.10.2130.04016.20
5.4.00.2100.04315.77
5.3.290.2300.04714.71
5.3.280.1970.05714.43
5.3.270.2230.03714.60
5.3.260.2230.04014.62
5.3.250.0500.03014.44
5.3.240.0030.03714.51
5.3.230.0170.04314.64
5.3.220.1900.03314.40
5.3.210.2230.04014.41
5.3.200.1930.04314.52
5.3.190.2030.04314.44
5.3.180.2200.04714.40
5.3.170.2270.03714.40
5.3.160.2200.03314.39
5.3.150.1900.03714.51
5.3.140.2070.04014.50
5.3.130.1900.04014.39
5.3.120.0170.04014.45
5.3.110.0170.03314.48
5.3.100.0170.03713.87
5.3.90.0170.03313.97
5.3.80.0200.04013.87
5.3.70.0300.03013.86
5.3.60.0170.03313.91
5.3.50.0100.04013.90
5.3.40.0270.02713.86
5.3.30.0130.05713.78
5.3.20.0130.04013.57
5.3.10.0170.03713.64
5.3.00.0130.03713.49
5.2.170.0100.04310.98
5.2.160.0070.03311.05
5.2.150.0130.04010.99
5.2.140.0230.03011.30
5.2.130.0130.02711.27
5.2.120.0170.03311.04
5.2.110.0130.06010.95
5.2.100.0170.03311.15
5.2.90.0200.05711.11
5.2.80.0170.06011.00
5.2.70.0130.03711.10
5.2.60.0070.03310.89
5.2.50.0130.05710.90
5.2.40.0100.03311.04
5.2.30.0130.03310.81
5.2.20.0100.05010.86
5.2.10.0130.05010.75
5.2.00.0200.04710.68
5.1.60.0070.03010.12
5.1.50.0130.0539.97
5.1.40.0100.03010.02
5.1.30.0130.03310.27
5.1.20.0030.03010.51
5.1.10.0100.05310.23
5.1.00.0130.0279.96
5.0.50.0070.0238.41
5.0.40.0070.0238.29
5.0.30.0070.0578.21
5.0.20.0100.0208.18
5.0.10.0130.0308.18
5.0.00.0070.0638.21
4.4.90.0070.0337.93
4.4.80.0030.0207.93
4.4.70.0100.0307.93
4.4.60.0070.0237.93
4.4.50.0100.0277.93
4.4.40.0100.0507.93
4.4.30.0070.0177.93
4.4.20.0100.0337.93
4.4.10.0070.0177.93
4.4.00.0070.0537.93
4.3.110.0070.0207.93
4.3.100.0070.0177.93
4.3.90.0070.0337.93
4.3.80.0030.0507.93
4.3.70.0100.0337.93
4.3.60.0070.0207.93
4.3.50.0070.0377.93
4.3.40.0100.0437.93
4.3.30.0070.0337.93
4.3.20.0030.0277.93
4.3.10.0070.0377.93
4.3.00.0100.0207.93

preferences:
43.56 ms | 401 KiB | 5 Q