3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* 7. Write a PHP script to remove all characters from a string except a-z A-Z 0-9 or " ". Go to the editor Sample string : abcde$ddfd @abcd )der] Expected Result : abcdeddfd abcd der - See more at: http://www.w3resource.com/php-exercises/php-regular-expression-exercises.php#sthash.fzCJEK6c.dpuf */ $text = 'abcde$ddfd @abcd )der]'; $reg = "/[^a-zA-Z0-9 ]/"; print preg_replace($reg, "", $text); ?>

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.70.0090.01218.30
8.3.60.0150.00616.63
8.3.50.0100.00522.11
8.3.40.0040.01118.92
8.3.30.0110.00318.95
8.3.20.0070.00020.20
8.3.10.0000.00823.45
8.3.00.0030.00519.19
8.2.180.0030.01716.50
8.2.170.0030.01022.96
8.2.160.0140.00020.43
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0000.00826.16
8.2.120.0030.00519.36
8.2.110.0050.00522.26
8.2.100.0080.00418.04
8.2.90.0060.00319.17
8.2.80.0050.00317.97
8.2.70.0050.00317.63
8.2.60.0030.00617.80
8.2.50.0080.00018.07
8.2.40.0040.00418.22
8.2.30.0040.00418.23
8.2.20.0040.00417.74
8.2.10.0000.00718.02
8.2.00.0050.00219.55
8.1.280.0110.00725.92
8.1.270.0000.00822.15
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00621.95
8.1.230.0080.00319.23
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0000.00917.38
8.1.190.0040.00417.25
8.1.180.0080.00018.10
8.1.170.0080.00018.71
8.1.160.0030.00321.97
8.1.150.0040.00418.72
8.1.140.0000.00917.59
8.1.130.0000.00717.85
8.1.120.0050.00317.46
8.1.110.0030.00517.51
8.1.100.0040.00417.55
8.1.90.0070.00017.50
8.1.80.0040.00417.58
8.1.70.0000.00817.48
8.1.60.0060.00317.59
8.1.50.0030.00517.59
8.1.40.0000.00817.62
8.1.30.0050.00317.70
8.1.20.0060.00317.63
8.1.10.0070.00017.57
8.1.00.0000.00817.45
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.32
8.0.270.0000.00717.21
8.0.260.0070.00017.27
8.0.250.0070.00017.07
8.0.240.0000.01117.05
8.0.230.0030.00316.99
8.0.220.0030.00317.04
8.0.210.0030.00317.00
8.0.200.0030.00316.92
8.0.190.0070.00016.95
8.0.180.0050.00316.89
8.0.170.0000.00816.98
8.0.160.0070.00016.93
8.0.150.0030.00516.93
8.0.140.0060.00316.92
8.0.130.0000.00613.44
8.0.120.0050.00316.85
8.0.110.0070.00016.89
8.0.100.0040.00417.09
8.0.90.0000.00716.81
8.0.80.0060.00917.01
8.0.70.0000.00817.02
8.0.60.0070.00016.79
8.0.50.0040.00416.79
8.0.30.0100.00917.39
8.0.20.0100.00917.40
8.0.10.0040.00417.14
8.0.00.0100.01116.86
7.4.330.0000.00715.00
7.4.320.0000.00616.64
7.4.300.0030.00316.64
7.4.290.0000.00716.64
7.4.280.0030.00516.73
7.4.270.0050.00316.75
7.4.260.0030.00716.65
7.4.250.0030.00316.56
7.4.240.0080.00016.68
7.4.230.0040.00416.65
7.4.220.0030.01416.71
7.4.210.0070.00716.77
7.4.200.0040.00416.63
7.4.160.0140.00416.69
7.4.150.0000.01817.40
7.4.140.0100.01017.86
7.4.130.0080.00916.65
7.4.120.0070.00916.50
7.4.110.0110.00616.63
7.4.100.0030.01316.66
7.4.90.0060.01316.52
7.4.80.0070.01719.39
7.4.70.0130.00516.49
7.4.60.0100.00616.46
7.4.50.0040.00416.59
7.4.40.0070.01016.52
7.4.30.0040.01216.72
7.4.00.0030.01315.27
7.3.330.0060.00013.16
7.3.320.0050.00013.19
7.3.310.0060.00016.36
7.3.300.0000.00716.26
7.3.290.0110.01116.30
7.3.280.0090.00816.27
7.3.270.0080.00817.40
7.3.260.0120.00616.28
7.3.250.0130.00416.63
7.3.240.0030.01516.64
7.3.230.0090.00916.40
7.3.210.0080.00816.38
7.3.200.0170.00019.39
7.3.190.0070.01416.59
7.3.180.0040.01116.44
7.3.170.0100.00716.39
7.3.160.0100.00716.34
7.3.120.0030.01314.73
7.2.330.0060.01516.49
7.2.320.0160.00616.63
7.2.310.0100.01416.61
7.2.300.0100.01016.42
7.2.290.0070.01116.80
7.2.60.0040.01217.02
7.2.00.0050.00819.54
7.1.200.0040.00816.00
7.1.100.0030.00918.34
7.1.70.0000.00717.23
7.1.60.0100.00619.70
7.1.50.0030.01317.05
7.1.00.0000.08022.38
7.0.200.0030.00716.24
7.0.140.0070.07022.13
7.0.100.0100.08019.88
7.0.90.0030.07719.95
7.0.80.0100.07320.01
7.0.70.0070.04720.12
7.0.60.0070.07719.94
7.0.50.0100.07320.36
7.0.40.0030.07320.03
7.0.30.0170.07720.09
7.0.20.0030.08320.04
7.0.10.0070.07320.14
7.0.00.0070.08720.13
5.6.280.0030.07321.10
5.6.250.0070.08320.71
5.6.240.0170.07020.59
5.6.230.0170.07320.65
5.6.220.0100.08020.47
5.6.210.0030.04020.56
5.6.200.0000.05021.02
5.6.190.0070.07020.95
5.6.180.0030.08021.03
5.6.170.0030.09021.08
5.6.160.0030.08321.01
5.6.150.0200.07021.07
5.6.140.0130.06720.87
5.6.130.0030.07721.01
5.6.120.0030.08020.92
5.6.110.0100.04021.04
5.6.100.0030.04321.02
5.6.90.0030.05721.05
5.6.80.0070.05020.43
5.6.70.0030.04020.43
5.6.60.0030.04020.28
5.6.50.0030.04020.46
5.6.40.0130.07720.30
5.6.30.0100.04720.29
5.6.20.0130.05720.42
5.6.10.0070.04020.39
5.6.00.0030.04020.41
5.5.380.0100.06720.48
5.5.370.0130.07720.39
5.5.360.0030.04320.43
5.5.350.0130.03320.41
5.5.340.0070.05320.88
5.5.330.0070.08320.88
5.5.320.0070.07720.82
5.5.310.0030.08320.88
5.5.300.0070.08720.91
5.5.290.0100.08320.81
5.5.280.0100.05320.91
5.5.270.0030.04320.90
5.5.260.0030.06020.91
5.5.250.0130.03720.61
5.5.240.0000.04320.28
5.5.230.0070.06320.27
5.5.220.0070.05320.23
5.5.210.0000.04320.29
5.5.200.0000.04320.25
5.5.190.0000.04720.21
5.5.180.0070.03320.26
5.5.160.0100.03020.23
5.5.150.0000.04320.16
5.5.140.0070.06720.16
5.5.130.0070.03720.07
5.5.120.0030.04020.23
5.5.110.0070.03720.21
5.5.100.0130.03020.05
5.5.90.0030.03720.04
5.5.80.0070.05020.03
5.5.70.0070.05319.96
5.5.60.0000.04020.14
5.5.50.0000.05320.00
5.5.40.0030.04020.13
5.5.30.0030.04720.08
5.5.20.0000.04320.12
5.5.10.0000.04320.07
5.5.00.0100.03320.02
5.4.450.0100.07719.29
5.4.440.0000.05019.44
5.4.430.0030.05319.44
5.4.420.0100.03319.46
5.4.410.0000.04319.43
5.4.400.0070.03719.06
5.4.390.0070.04019.03
5.4.380.0030.03718.96
5.4.370.0030.04319.10
5.4.360.0070.05318.96
5.4.350.0100.03318.81
5.4.340.0070.03719.23
5.4.320.0030.03718.98
5.4.310.0000.03719.14
5.4.300.0070.04319.14
5.4.290.0030.04719.04
5.4.280.0070.03719.03
5.4.270.0000.04019.05
5.4.260.0130.06319.12
5.4.250.0030.03319.02
5.4.240.0030.06719.02
5.4.230.0000.04318.94
5.4.220.0030.03718.77
5.4.210.0070.06019.22
5.4.200.0070.03319.22
5.4.190.0070.03719.04
5.4.180.0000.04019.04
5.4.170.0000.04019.13
5.4.160.0030.06319.01
5.4.150.0030.04319.05
5.4.140.0070.03716.37
5.4.130.0000.05716.36
5.4.120.0070.07716.36
5.4.110.0130.06716.31
5.4.100.0070.07716.41
5.4.90.0000.08016.40
5.4.80.0200.06716.24
5.4.70.0100.06716.29
5.4.60.0130.06716.33
5.4.50.0070.07016.33
5.4.40.0070.08016.46
5.4.30.0100.06316.32
5.4.20.0070.07716.30
5.4.10.0100.07016.41
5.4.00.0000.07715.80
5.3.290.0070.04714.65
5.3.280.0070.04314.45
5.3.270.0000.05714.57
5.3.260.0070.03014.59
5.3.250.0030.03314.56
5.3.240.0030.03714.55
5.3.230.0070.03714.54
5.3.220.0030.07014.47
5.3.210.0130.07314.52
5.3.200.0070.07314.55
5.3.190.0170.07014.51
5.3.180.0100.07314.53
5.3.170.0100.06714.38
5.3.160.0000.08314.41
5.3.150.0100.07314.46
5.3.140.0070.08014.57
5.3.130.0100.07014.54
5.3.120.0100.07314.54
5.3.110.0070.08014.39
5.3.100.0170.03713.89
5.3.90.0030.08013.99
5.3.80.0000.04714.00
5.3.70.0100.07313.77
5.3.60.0070.07713.91
5.3.50.0030.05313.90
5.3.40.0100.07013.96
5.3.30.0030.07713.86
5.3.20.0030.07713.62
5.3.10.0030.07313.42
5.3.00.0070.05713.48
5.2.170.0030.06711.13
5.2.160.0100.06011.09
5.2.150.0000.07011.06
5.2.140.0030.06311.12
5.2.130.0030.06311.15
5.2.120.0100.06011.09
5.2.110.0070.06311.13
5.2.100.0030.06311.04
5.2.90.0070.05710.94
5.2.80.0070.06311.08
5.2.70.0100.06311.14
5.2.60.0100.05011.04
5.2.50.0070.05310.84
5.2.40.0030.04711.04
5.2.30.0030.04310.89
5.2.20.0000.05310.82
5.2.10.0000.06310.90
5.2.00.0000.06310.75
5.1.60.0070.05310.02
5.1.50.0100.04710.07
5.1.40.0070.05010.00
5.1.30.0030.05710.35
5.1.20.0070.04310.40
5.1.10.0070.0479.94
5.1.00.0030.06010.09
5.0.50.0130.0339.30
5.0.40.0070.0179.30
5.0.30.0070.0509.30
5.0.20.0000.0279.30
5.0.10.0000.0339.30
5.0.00.0070.0579.30
4.4.90.0030.0239.30
4.4.80.0030.0339.30
4.4.70.0030.0309.30
4.4.60.0030.0339.30
4.4.50.0030.0279.30
4.4.40.0000.0579.30
4.4.30.0030.0339.30
4.4.20.0100.0279.30
4.4.10.0000.0209.30
4.4.00.0030.0539.30
4.3.110.0030.0279.30
4.3.100.0000.0379.30
4.3.90.0000.0379.30
4.3.80.0070.0509.30
4.3.70.0030.0339.30
4.3.60.0030.0339.30
4.3.50.0070.0309.30
4.3.40.0000.0379.30
4.3.30.0000.0379.30
4.3.20.0000.0379.30
4.3.10.0000.0409.30
4.3.00.0000.0379.30

preferences:
32.8 ms | 401 KiB | 5 Q