3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/html; charset=UTF-8'); $str = "<h1>He'llü & Wor&#39;ldÆØÅÅÅ!</h1>" . "\tcafé\n"; if ('UTF-8' !== mb_detect_encoding($str)) { $str = utf8_encode($str); } var_dump($str); $str = html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8'); var_dump($str); $str = filter_var(html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8'), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_NO_ENCODE_QUOTES); var_dump($str); #$newstr = preg_replace('/\s[\s]+/', ' ', $str); // Strip off multiple spaces $newstr = preg_replace('/[^\000-\0128]+/', '', $str); // Strip off non-alpha-numeric #$newstr = preg_replace('/[\s\W]+/', '-', $newstr); // Strip off spaces and non-alpha-numeric #$newstr = preg_replace('/[^A-Za-z0-9_-]+/', '', $newstr); var_dump($newstr);

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.0150.00618.68
8.3.50.0030.01018.41
8.3.40.0150.00018.88
8.3.30.0100.01318.79
8.3.20.0050.00321.90
8.3.10.0040.00423.66
8.3.00.0050.00321.91
8.2.180.0070.01118.66
8.2.170.0070.01122.96
8.2.160.0140.00022.23
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00019.57
8.2.120.0000.00726.35
8.2.110.0060.00319.35
8.2.100.0090.00318.09
8.2.90.0030.00619.26
8.2.80.0030.00519.25
8.2.70.0000.00917.75
8.2.60.0080.00018.05
8.2.50.0030.00518.10
8.2.40.0070.00020.27
8.2.30.0030.00519.34
8.2.20.0000.00718.09
8.2.10.0040.00418.32
8.2.00.0030.00617.99
8.1.280.0070.00725.92
8.1.270.0000.00723.90
8.1.260.0040.00826.35
8.1.250.0070.00328.09
8.1.240.0060.00322.67
8.1.230.0080.00417.71
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0040.00417.48
8.1.190.0040.00417.35
8.1.180.0070.00418.10
8.1.170.0040.00418.74
8.1.160.0040.00418.86
8.1.150.0000.00722.03
8.1.140.0000.00719.73
8.1.130.0060.00319.04
8.1.120.0040.00417.57
8.1.110.0040.00417.54
8.1.100.0000.00717.69
8.1.90.0040.00417.68
8.1.80.0040.00417.70
8.1.70.0000.00817.69
8.1.60.0030.00617.75
8.1.50.0040.00417.76
8.1.40.0040.00417.63
8.1.30.0000.00817.86
8.1.20.0000.00817.84
8.1.10.0050.00217.79
8.1.00.0040.00417.55
8.0.300.0050.00318.77
8.0.290.0040.00416.88
8.0.280.0030.00318.52
8.0.270.0030.00317.16
8.0.260.0030.00317.29
8.0.250.0070.00017.09
8.0.240.0040.00417.09
8.0.230.0030.00317.03
8.0.220.0040.00417.00
8.0.210.0070.00016.93
8.0.200.0000.00817.02
8.0.190.0040.00417.11
8.0.180.0070.00017.14
8.0.170.0000.00716.95
8.0.160.0030.00517.00
8.0.150.0040.00717.04
8.0.140.0000.00716.91
8.0.130.0050.00013.50
8.0.120.0040.00416.86
8.0.110.0070.00016.82
8.0.100.0080.00017.03
8.0.90.0070.00017.07
8.0.80.0090.00617.00
8.0.70.0000.00716.85
8.0.60.0080.00016.89
8.0.50.0070.00017.02
8.0.30.0090.01117.22
8.0.20.0130.00617.45
8.0.10.0000.00817.08
8.0.00.0110.00616.91
7.4.330.0050.00015.55
7.4.320.0030.00316.86
7.4.300.0030.00316.67
7.4.290.0070.00016.91
7.4.280.0000.00716.75
7.4.270.0070.00016.73
7.4.260.0030.00316.65
7.4.250.0000.00716.75
7.4.240.0030.00316.90
7.4.230.0050.00216.88
7.4.220.0180.00716.77
7.4.210.0120.00316.89
7.4.200.0030.00616.86
7.4.160.0130.00616.69
7.4.150.0090.00917.40
7.4.140.0070.01217.86
7.4.130.0120.00716.67
7.4.120.0070.01116.64
7.4.110.0030.01416.69
7.4.100.0090.00916.60
7.4.90.0050.01116.64
7.4.80.0060.01119.39
7.4.70.0070.01016.62
7.4.60.0130.00316.88
7.4.50.0040.00716.93
7.4.40.0040.01316.62
7.4.30.0140.00316.66
7.4.00.0030.00815.11
7.3.330.0060.00013.20
7.3.320.0060.00013.34
7.3.310.0080.00016.46
7.3.300.0000.00716.39
7.3.290.0060.01016.52
7.3.280.0100.00916.43
7.3.270.0070.01117.40
7.3.260.0110.00916.58
7.3.250.0100.00716.56
7.3.240.0090.01316.54
7.3.230.0070.01016.36
7.3.210.0100.00716.80
7.3.200.0160.01016.44
7.3.190.0110.00616.70
7.3.180.0090.00616.44
7.3.170.0090.00916.46
7.3.160.0060.01016.57
7.2.330.0070.01116.74
7.2.320.0090.00916.70
7.2.310.0070.01016.66
7.2.300.0130.00916.69
7.2.290.0120.00816.75
7.2.60.0070.00717.14
7.2.50.0120.01217.11
7.1.200.0110.00015.98
7.1.70.0130.00317.30
7.1.60.0370.00715.61
7.1.10.0170.06022.22
7.1.00.0200.04722.29
7.0.200.0040.01416.57
7.0.150.0130.05321.85
7.0.140.0100.06321.86
7.0.130.0130.05721.82
7.0.120.0100.06021.90
7.0.110.0070.06021.91
7.0.100.0070.06021.82
7.0.90.0200.05721.78
7.0.80.0070.05721.83
7.0.70.0030.06021.83
7.0.60.0000.06721.69
7.0.50.0170.06721.90
7.0.40.0130.06321.94
7.0.30.0030.08021.84
7.0.20.0070.06021.79
7.0.10.0100.05721.86
7.0.00.0070.06321.88

preferences:
31.58 ms | 400 KiB | 5 Q