3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "ABCDE \t\n\r\x0B\x0C\0\x20\x0e\x20\x0f"; $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", "\x0C", "\0", "\x20\x0e", "\x20\x0f"), '', $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.0100.00316.63
8.3.50.0120.00722.97
8.3.40.0150.00018.84
8.3.30.0120.00419.05
8.3.20.0050.00320.22
8.3.10.0090.00023.56
8.3.00.0030.00519.38
8.2.180.0120.00316.88
8.2.170.0150.00022.96
8.2.160.0040.01120.39
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0090.00026.16
8.2.120.0050.00321.29
8.2.110.0030.00722.20
8.2.100.0090.00318.03
8.2.90.0060.00317.75
8.2.80.0030.00617.97
8.2.70.0040.00417.80
8.2.60.0000.00817.80
8.2.50.0000.00818.10
8.2.40.0000.00920.42
8.2.30.0030.00519.52
8.2.20.0030.00517.70
8.2.10.0040.00417.93
8.2.00.0040.00417.76
8.1.280.0120.00325.92
8.1.270.0060.00323.97
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0090.00019.31
8.1.230.0030.00919.01
8.1.220.0060.00617.74
8.1.210.0080.00018.77
8.1.200.0060.00617.22
8.1.190.0060.00317.22
8.1.180.0000.00818.10
8.1.170.0050.00418.62
8.1.160.0000.00721.89
8.1.150.0000.00718.80
8.1.140.0040.00417.59
8.1.130.0000.00817.84
8.1.120.0000.00717.43
8.1.110.0040.00417.45
8.1.100.0000.00817.43
8.1.90.0030.00317.52
8.1.80.0000.00817.61
8.1.70.0000.00717.41
8.1.60.0070.00317.73
8.1.50.0060.00317.60
8.1.40.0040.00417.58
8.1.30.0040.00417.69
8.1.20.0040.00417.64
8.1.10.0000.00817.61
8.1.00.0040.00417.42
8.0.300.0060.00319.77
8.0.290.0100.00016.75
8.0.280.0000.00718.25
8.0.270.0000.00717.12
8.0.260.0000.00617.20
8.0.250.0000.00717.05
8.0.240.0070.00016.99
8.0.230.0000.00716.96
8.0.220.0030.00317.04
8.0.210.0030.00316.86
8.0.200.0030.00317.06
8.0.190.0040.00417.07
8.0.180.0000.00816.94
8.0.170.0030.00516.97
8.0.160.0000.00817.02
8.0.150.0020.00516.97
8.0.140.0040.00416.91
8.0.130.0000.00713.35
8.0.120.0030.00516.99
8.0.110.0040.00416.99
8.0.100.0000.00716.86
8.0.90.0050.00217.01
8.0.80.0030.01216.89
8.0.70.0030.00616.84
8.0.60.0040.00416.98
8.0.50.0000.00816.85
8.0.30.0120.00817.00
8.0.20.0110.01317.40
8.0.10.0040.00416.96
8.0.00.0130.00516.71
7.4.330.0000.00615.00
7.4.320.0060.00016.75
7.4.300.0060.00016.76
7.4.290.0030.00316.65
7.4.280.0000.00716.63
7.4.270.0070.00016.52
7.4.260.0040.00816.61
7.4.250.0020.00516.64
7.4.240.0020.00516.76
7.4.230.0070.00016.68
7.4.220.0150.00616.68
7.4.210.0000.01416.66
7.4.200.0000.00716.63
7.4.160.0100.01316.70
7.4.150.0170.00317.40
7.4.140.0140.00517.86
7.4.130.0080.00916.79
7.4.120.0120.00916.50
7.4.110.0090.00916.74
7.4.100.0090.00816.70
7.4.90.0220.01616.70
7.4.80.0030.01619.39
7.4.70.0090.00916.64
7.4.60.0090.00616.47
7.4.50.0000.00816.62
7.4.40.0030.01316.56
7.4.30.0090.00616.65
7.4.00.0060.01015.07
7.3.330.0020.00213.09
7.3.320.0000.00513.27
7.3.310.0040.00416.29
7.3.300.0060.00016.34
7.3.290.0040.01116.39
7.3.280.0100.00716.36
7.3.270.0070.01317.40
7.3.260.0040.01416.63
7.3.250.0110.00816.55
7.3.240.0100.00716.38
7.3.230.0170.00016.48
7.3.210.0110.00616.30
7.3.200.0190.00319.39
7.3.190.0060.01116.53
7.3.180.0040.01316.29
7.3.170.0140.00316.38
7.3.160.0060.01016.52
7.3.120.0100.00714.93
7.3.110.0140.00314.88
7.3.100.0100.00014.89
7.3.90.0060.00614.98
7.3.80.0090.00314.67
7.3.70.0000.01714.92
7.3.60.0000.01114.96
7.3.50.0090.00014.86
7.3.40.0070.01014.95
7.3.30.0070.00714.74
7.3.20.0030.01016.55
7.3.10.0080.00816.77
7.3.00.0030.01216.87
7.2.330.0070.01116.75
7.2.320.0000.01716.79
7.2.310.0060.01916.53
7.2.300.0120.01116.61
7.2.290.0130.00316.64
7.2.250.0070.01114.99
7.2.240.0100.01015.13
7.2.230.0000.01615.08
7.2.220.0060.00914.94
7.2.210.0040.01414.84
7.2.200.0090.00614.96
7.2.190.0040.01115.02
7.2.180.0060.00615.32
7.2.170.0060.00614.92
7.2.60.0030.01317.02
7.2.00.0090.00019.63
7.1.330.0080.00816.03
7.1.320.0060.00615.70
7.1.310.0030.00916.04
7.1.300.0030.01015.54
7.1.290.0060.01015.86
7.1.280.0060.00616.08
7.1.270.0080.00315.93
7.1.260.0040.00715.91
7.1.200.0100.00615.93
7.1.100.0070.00718.02
7.1.70.0000.00817.16
7.1.60.0070.01319.46
7.1.50.0070.01417.09
7.1.00.0000.07722.38
7.0.200.0060.00316.91
7.0.140.0030.07321.95
7.0.60.0270.07319.94
7.0.50.0070.08317.70
7.0.40.0030.04320.01
7.0.30.0300.08320.14
7.0.20.0230.04320.04
7.0.10.0070.08720.34
7.0.00.0030.05720.11
5.6.280.0000.07020.89
5.6.210.0070.07020.54
5.6.200.0100.08318.16
5.6.190.0130.06320.43
5.6.180.0270.07720.77
5.6.170.0200.03720.49
5.6.160.0000.08318.22
5.6.150.0070.04318.22
5.6.140.0070.07718.21
5.6.130.0030.04018.09
5.6.120.0030.08721.04
5.6.110.0000.04721.00
5.6.100.0100.08321.12
5.6.90.0030.09021.13
5.6.80.0030.07020.52
5.5.350.0170.04320.40
5.5.340.0100.06318.02
5.5.330.0070.07020.37
5.5.320.0230.08020.23
5.5.310.0270.08020.32
5.5.300.0070.05317.95
5.5.290.0100.08017.95
5.5.280.0130.07720.87
5.5.270.0000.04320.76
5.5.260.0030.04720.96
5.5.250.0170.07020.69
5.5.240.0130.07720.35
5.4.450.0270.04719.46
5.4.440.0570.04719.57
5.4.430.0600.04319.10
5.4.420.0200.04319.38
5.4.410.0300.03319.33
5.4.400.0330.04019.16
5.4.390.0400.04319.13
5.4.380.0370.05018.67
5.4.370.0430.05718.75
5.4.360.0400.04718.57
5.4.350.0270.05718.44
5.4.340.0470.06318.50
5.4.320.0070.03612.46
5.4.310.0070.04112.45
5.4.300.0060.04012.45
5.4.290.0050.05312.45
5.4.280.0090.03312.35
5.4.270.0090.03412.35
5.4.260.0080.03812.34
5.4.250.0090.03812.35
5.4.240.0060.03912.35
5.4.230.0070.03812.34
5.4.220.0060.03712.34
5.4.210.0070.03512.34
5.4.200.0100.03912.34
5.4.190.0040.03812.34
5.4.180.0090.04012.34
5.4.170.0100.03712.35
5.4.160.0060.03612.34
5.4.150.0070.03712.34
5.4.140.0060.03712.02
5.4.130.0090.03412.02
5.4.120.0090.03411.97
5.4.110.0070.03511.96
5.4.100.0090.03411.97
5.4.90.0100.03411.96
5.4.80.0020.04311.97
5.4.70.0040.03711.96
5.4.60.0090.03611.96
5.4.50.0050.03811.96
5.4.40.0090.03411.95
5.4.30.0100.04011.95
5.4.20.0040.04311.95
5.4.10.0060.04711.95
5.4.00.0090.04711.43
5.3.290.0070.05212.80
5.3.280.0070.03712.71
5.3.270.0090.04112.73
5.3.260.0110.03612.72
5.3.250.0050.04412.72
5.3.240.0060.04412.72
5.3.230.0060.03812.71
5.3.220.0060.03912.68
5.3.210.0100.04412.68
5.3.200.0090.03612.68
5.3.190.0080.04112.68
5.3.180.0040.04112.67
5.3.170.0050.04512.67
5.3.160.0080.04112.68
5.3.150.0050.03812.68
5.3.140.0080.03812.66
5.3.130.0070.04112.66
5.3.120.0060.04012.66
5.3.110.0060.03912.66
5.3.100.0070.04412.12
5.3.90.0090.04212.09
5.3.80.0050.03812.07
5.3.70.0050.04012.07
5.3.60.0080.04112.07
5.3.50.0060.03712.01
5.3.40.0040.04512.00
5.3.30.0050.03711.96
5.3.20.0080.03811.74
5.3.10.0050.05311.70
5.3.00.0050.03811.69
5.2.170.0050.0379.19
5.2.160.0080.0279.20
5.2.150.0040.0329.19
5.2.140.0050.0319.19
5.2.130.0070.0339.15
5.2.120.0080.0289.15
5.2.110.0060.0299.16
5.2.100.0020.0349.16
5.2.90.0040.0309.15
5.2.80.0070.0329.15
5.2.70.0040.0329.15
5.2.60.0020.0359.10
5.2.50.0030.0329.07
5.2.40.0050.0299.05
5.2.30.0040.0359.02
5.2.20.0060.0299.02
5.2.10.0040.0318.92
5.2.00.0050.0328.78
5.1.60.0040.0278.07
5.1.50.0030.0308.06
5.1.40.0040.0258.04
5.1.30.0100.0228.39
5.1.20.0060.0308.41
5.1.10.0070.0298.14
5.1.00.0080.0238.14
5.0.50.0050.0246.63
5.0.40.0020.0216.49
5.0.30.0030.0326.30
5.0.20.0040.0206.27
5.0.10.0020.0216.25
5.0.00.0040.0346.24
4.4.90.0040.0144.78
4.4.80.0040.0214.75
4.4.70.0040.0194.75
4.4.60.0040.0184.75
4.4.50.0050.0134.77
4.4.40.0030.0274.71
4.4.30.0040.0194.76
4.4.20.0030.0164.84
4.4.10.0040.0164.85
4.4.00.0030.0254.76
4.3.110.0030.0184.67
4.3.100.0030.0154.66
4.3.90.0040.0134.64
4.3.80.0020.0254.58
4.3.70.0030.0154.63
4.3.60.0050.0204.63
4.3.50.0040.0174.62
4.3.40.0020.0294.54
4.3.30.0030.0163.29
4.3.20.0020.0183.27
4.3.10.0010.0163.23
4.3.00.0000.02018.56

preferences:
47.9 ms | 401 KiB | 5 Q