3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Stripper{ private $regex; private $stripped; private $decoded; private $current_encoding; private $result; function __construct(){ mb_internal_encoding('UTF-8'); //mb_regex_encoding("UTF-8"); setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu'); } function convert($string, $targetEncoding = 'UTF-8'){ $current_encoding = mb_detect_encoding($string); if($current_encoding != $targetEncoding){ $string = mb_convert_encoding($string, $targetEncoding, mb_detect_encoding($string)); } $result = $string; return $result; } //this function returns characters, whitespace, underscores and linebreaks plus @ , and - function strip($string){ //$this->convert($string); $result = mb_ereg_replace("[^\w\s@,\-\.]*", "", $string); return $result; } //this function returns $digits of number and discards everything else function onlyNumbers($string, $digits=0){ //$this->convert($string); $result = mb_ereg_replace("[^\d]*", "", $string); if($digits > 0){ $result = substr($result, 0, $digits); } return $result; } function decode($string, $type="all"){ //$this->convert($string); if($type == "all" || $type == "strip"){ $string = stripslashes($string); } if ($type == "all" || $type == "decode"){ $string = urldecode($string); } $result = $string; return $result; } } //mb_detect_order ( mb_internal_encoding('UTF-8'); mb_http_output('UTF-8'); mb_http_input('UTF-8'); mb_language('uni'); mb_regex_encoding('UTF-8'); ob_start('mb_output_handler'); //var_dump(mb_regex_encoding()); //var_dump( mb_get_info()); $value = "Häslïchëräëÿüïöáéüúíóßñµç.,_-;()''\"\" "; //$value = $stripper->decode($value); //$value = $stripper->convert($value); echo "before strip :" . mb_detect_encoding($value) . " for $value<br />"; //$_POST[$key] = $purifier->purify($_POST[$key]); //$value = str_replace("ß","ss",$value); $stripper = new Stripper(); $value = $stripper->strip($value); echo "after strip :". mb_detect_encoding($value) . " for $value<br />"; //phpinfo();

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.0140.00018.43
8.3.50.0110.00822.03
8.3.40.0120.00318.76
8.3.30.0110.00319.16
8.3.20.0070.00020.35
8.3.10.0040.00421.78
8.3.00.0090.00017.89
8.2.180.0060.01516.75
8.2.170.0000.01522.96
8.2.160.0100.00320.37
8.2.150.0070.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0050.00320.97
8.2.110.0100.00021.02
8.2.100.0110.00517.91
8.2.90.0000.00919.05
8.2.80.0050.00317.97
8.2.70.0100.00017.63
8.2.60.0050.00317.68
8.2.50.0030.00618.07
8.2.40.0030.00618.22
8.2.30.0040.00417.92
8.2.20.0030.00617.61
8.2.10.0080.00018.03
8.2.00.0030.00517.76
8.1.280.0100.00725.92
8.1.270.0040.00423.63
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00022.02
8.1.230.0150.00018.85
8.1.220.0000.00817.74
8.1.210.0030.00718.77
8.1.200.0090.00017.23
8.1.190.0040.00417.13
8.1.180.0060.00318.10
8.1.170.0000.00818.50
8.1.160.0040.00422.00
8.1.150.0030.00518.71
8.1.140.0040.00417.31
8.1.130.0030.00317.85
8.1.120.0040.00417.44
8.1.110.0080.00017.38
8.1.100.0070.00017.40
8.1.90.0110.00017.27
8.1.80.0000.00717.44
8.1.70.0070.00017.33
8.1.60.0060.00317.51
8.1.50.0000.00817.55
8.1.40.0040.00717.57
8.1.30.0000.00817.66
8.1.20.0060.00317.64
8.1.10.0040.00417.51
8.1.00.0000.00817.53
8.0.300.0040.00422.09
8.0.290.0040.00416.63
8.0.280.0000.00718.42
8.0.270.0070.00017.25
8.0.260.0080.00017.19
8.0.250.0000.00816.96
8.0.240.0040.00416.99
8.0.230.0070.00016.88
8.0.220.0040.00416.80
8.0.210.0030.00316.82
8.0.200.0040.00416.99
8.0.190.0050.00216.87
8.0.180.0040.00416.87
8.0.170.0080.00017.00
8.0.160.0040.00416.80
8.0.150.0000.00716.80
8.0.140.0050.00216.73
8.0.130.0060.00013.32
8.0.120.0000.00816.91
8.0.110.0040.00416.95
8.0.100.0030.00516.73
8.0.90.0000.00716.82
8.0.80.0040.01116.92
8.0.70.0040.00416.88
8.0.60.0040.00417.00
8.0.50.0030.00616.82
8.0.30.0070.01317.27
8.0.20.0170.00617.40
8.0.10.0000.00717.04
8.0.00.0100.00816.77
7.4.330.0020.00215.65
7.4.320.0060.00017.12
7.4.300.0000.00717.14
7.4.290.0070.00417.15
7.4.280.0030.00717.17
7.4.270.0070.00017.16
7.4.260.0030.00517.04
7.4.250.0040.00417.09
7.4.240.0040.00317.14
7.4.230.0040.00517.04
7.4.220.0030.01517.27
7.4.210.0030.01017.27
7.4.200.0000.00717.07
7.4.160.0040.01117.02
7.4.150.0070.01117.40
7.4.140.0090.00917.86
7.4.130.0150.00517.16
7.4.120.0110.00617.10
7.4.110.0100.01016.96
7.4.100.0100.01017.20
7.4.90.0100.00716.94
7.4.80.0120.01019.39
7.4.70.0070.01717.02
7.4.60.0100.01016.94
7.4.50.0030.00316.86
7.4.40.0090.00917.04
7.4.30.0080.00817.15
7.4.00.0070.01015.20
7.3.330.0030.00313.79
7.3.320.0050.00013.84
7.3.310.0070.00016.89
7.3.300.0000.00716.81
7.3.290.0000.01516.84
7.3.280.0090.00916.86
7.3.270.0150.00317.40
7.3.260.0130.01016.93
7.3.240.0150.00916.72
7.3.230.0100.00717.08
7.3.210.0070.01017.13
7.3.200.0140.01119.39
7.3.190.0090.01317.05
7.3.180.0070.01016.93
7.3.170.0040.01516.81
7.3.160.0100.00617.10
7.3.120.0100.00714.73
7.3.110.0100.00715.20
7.3.100.0070.00715.23
7.3.90.0090.00614.91
7.3.80.0000.00914.85
7.3.70.0000.01215.11
7.3.60.0000.01414.82
7.3.50.0110.00314.92
7.3.40.0050.00515.09
7.3.30.0000.01414.77
7.3.20.0000.01616.95
7.3.10.0040.01216.41
7.3.00.0040.00816.77
7.2.330.0150.00317.02
7.2.320.0100.00717.12
7.2.310.0090.00917.34
7.2.300.0090.00916.80
7.2.290.0110.01317.33
7.2.250.0110.00715.49
7.2.240.0130.00715.36
7.2.230.0030.01315.39
7.2.220.0110.00315.01
7.2.210.0130.00315.20
7.2.200.0000.00915.33
7.2.190.0080.00415.23
7.2.180.0100.00315.23
7.2.170.0070.00315.24
7.2.110.0120.00816.59
7.2.100.0790.00716.57
7.2.90.0150.00416.53
7.2.80.0520.00316.60
7.2.70.0030.01517.00
7.2.60.0130.00416.95
7.2.50.0100.00516.92
7.2.40.0120.00916.97
7.2.30.0110.00817.06
7.2.20.0190.00016.99
7.2.10.0200.00717.09
7.2.00.0080.01217.13
7.1.330.0030.01015.98
7.1.320.0040.01115.92
7.1.310.0000.01315.92
7.1.300.0060.01015.65
7.1.290.0030.00715.94
7.1.280.0000.01715.73
7.1.270.0030.00915.73
7.1.260.0040.00815.98
7.1.230.0090.00516.05
7.1.220.0160.00015.56
7.1.210.0070.01016.11
7.1.200.0080.00515.82
7.1.190.0100.00915.93
7.1.180.0280.00315.88
7.1.170.0290.00615.63
7.1.160.0090.00616.12
7.1.150.0070.00716.00
7.1.140.0110.00815.95
7.1.130.0100.00715.68
7.1.120.0350.00615.65
7.1.110.0100.00515.94
7.1.100.0170.00016.00
7.1.90.0160.00315.79
7.1.80.0130.00315.72
7.1.70.0090.00116.61
7.1.60.0120.01217.76
7.1.50.0090.01116.63
7.1.40.0110.00916.23
7.1.30.0090.00916.14
7.1.20.0070.01016.12
7.1.10.0060.01215.99
7.1.00.0030.04319.25
7.0.310.0110.00515.19
7.0.300.0220.01215.44
7.0.290.0090.00915.38
7.0.280.0100.00515.50
7.0.270.0060.00915.65
7.0.260.0060.00915.36
7.0.250.0380.00315.64
7.0.240.0000.01215.46
7.0.230.0070.00715.45
7.0.220.0140.00315.52
7.0.210.0080.00815.53
7.0.200.0080.01016.33
7.0.190.0080.00815.43
7.0.180.0080.00815.50
7.0.170.0080.00515.67
7.0.160.0100.01015.47
7.0.150.0040.01015.51
7.0.140.0030.04118.75
7.0.130.0000.01615.27
7.0.120.0100.00515.70
7.0.110.0140.00315.44
7.0.100.0120.00215.77
7.0.90.0030.01415.61
7.0.80.0100.01015.59
7.0.70.0110.00415.35
7.0.60.0060.04617.75
7.0.50.0080.03916.80
7.0.40.0080.02516.81
7.0.30.0130.02416.87
7.0.20.0170.04416.79
7.0.10.0130.02716.79
7.0.00.0100.02716.83
5.6.380.0150.00314.11
5.6.370.0060.01214.61
5.6.360.0080.00914.53
5.6.350.0130.00714.68
5.6.340.0060.00914.28
5.6.330.0090.00914.62
5.6.320.0100.00714.68
5.6.310.0140.00014.20
5.6.300.0050.01114.44
5.6.290.0080.00814.46
5.6.280.0040.01214.46
5.6.270.0080.00614.44
5.6.260.0170.00014.29
5.6.250.0090.00614.28
5.6.240.0100.00714.19
5.6.230.0140.00314.43
5.6.220.0080.00814.49
5.6.210.0110.02217.64
5.6.200.0090.04316.36
5.6.190.0050.03117.67
5.6.180.1740.02117.44
5.6.170.0210.03817.50
5.6.160.0070.04417.41
5.6.150.0070.02416.35
5.6.140.0060.02616.28
5.6.130.0080.02816.39
5.6.120.0160.03217.66
5.6.110.0100.04517.82
5.6.100.0120.04017.70
5.6.90.0110.04017.81
5.6.80.0100.04017.40
5.6.70.1030.02017.37
5.6.60.0090.00914.60
5.6.50.0050.01114.59
5.6.40.0000.01314.13
5.6.30.0110.00414.52
5.6.20.0100.01014.14
5.6.10.0130.00514.37
5.6.00.0100.00714.35
5.5.380.0070.00712.79
5.5.370.0120.00412.79
5.5.360.0090.00312.79
5.5.350.0050.02016.57
5.5.340.0050.02315.40
5.5.330.0040.03516.53
5.5.320.0050.02316.54
5.5.310.0160.02416.67
5.5.300.0070.02215.40
5.5.290.0100.03815.45
5.5.280.0070.03916.82
5.5.270.0160.03516.80
5.5.260.0120.01716.72
5.5.250.0040.04416.69
5.5.240.0040.02316.53
5.5.230.0060.00912.79
5.5.220.0110.00412.79
5.5.210.0130.00012.79
5.5.200.0100.00312.79
5.5.190.0120.00012.79
5.5.180.0060.00612.79
5.5.170.0030.01014.50
5.5.160.0110.00312.79
5.5.150.0060.00912.79
5.5.140.0130.00412.79
5.5.130.0080.00612.79
5.5.120.0040.01012.79
5.5.110.0090.00612.79
5.5.100.0040.01312.79
5.5.90.0100.00712.79
5.5.80.0130.00012.79
5.5.70.0050.00512.79
5.5.60.0050.00512.79
5.5.50.0110.00412.79
5.5.40.0120.00312.79
5.5.30.0050.00812.79
5.5.20.0120.00012.79
5.5.10.0150.00012.79
5.5.00.0080.00412.79
5.4.450.0470.03116.20
5.4.440.0160.02516.18
5.4.430.0130.03016.19
5.4.420.0050.03316.23
5.4.410.0130.02815.99
5.4.400.0520.03015.66
5.4.390.0540.02615.80
5.4.380.0150.02715.71
5.4.370.0180.02515.77
5.4.360.0190.02215.78
5.4.350.0090.03612.43
5.4.340.0080.02012.43
5.4.330.0000.01012.79
5.4.320.0070.02312.67
5.4.310.0070.02012.67
5.4.300.0020.02912.67
5.4.290.0080.02212.67
5.4.280.0070.02012.62
5.4.270.0070.02112.62
5.4.260.0100.02112.62
5.4.250.0070.02312.62
5.4.240.0050.02512.62
5.4.230.0110.01912.62
5.4.220.0040.02312.62
5.4.210.0070.01912.62
5.4.200.0090.01812.62
5.4.190.0100.01612.62
5.4.180.0050.02112.62
5.4.170.0100.01812.62
5.4.160.0070.02012.62
5.4.150.0070.02012.62
5.4.140.0040.02412.46
5.4.130.0050.02412.45
5.4.120.0060.02012.43
5.4.110.0060.02212.43
5.4.100.0080.02212.43
5.4.90.0040.02612.43
5.4.80.0070.02412.43
5.4.70.0090.01912.42
5.4.60.0090.02012.43
5.4.50.0060.02012.42
5.4.40.0070.02012.42
5.4.30.0070.02212.42
5.4.20.0060.02212.42
5.4.10.0090.02012.42
5.4.00.0080.02212.17
5.3.290.0080.02412.80
5.3.280.0050.02412.77
5.3.270.0090.02112.78
5.3.260.0040.02912.78
5.3.250.0100.01712.78
5.3.240.0090.01912.77
5.3.230.0040.02212.77
5.3.220.0060.02212.75
5.3.210.0090.02012.75
5.3.200.0080.02312.75
5.3.190.0060.02312.75
5.3.180.0080.02012.75
5.3.170.0030.02412.76
5.3.160.0100.02112.75
5.3.150.0060.02112.75
5.3.140.0050.02312.75
5.3.130.0070.02112.74
5.3.120.0040.02412.74
5.3.110.0070.02112.75
5.3.100.0090.02012.49
5.3.90.0050.02112.48
5.3.80.0040.02212.48
5.3.70.0080.01912.48
5.3.60.0070.02112.47
5.3.50.0090.02112.45
5.3.40.0080.01812.44
5.3.30.0060.02112.43
5.3.20.0060.02112.32
5.3.10.0070.02112.30
5.3.00.0050.02212.29
5.2.170.0020.02111.04
5.2.160.0050.01911.04
5.2.150.0040.01811.04
5.2.140.0070.01711.04
5.2.130.0090.01411.02
5.2.120.0050.02211.02
5.2.110.0060.01511.03
5.2.100.0040.01711.02
5.2.90.0070.01611.02
5.2.80.0030.01811.02
5.2.70.0090.01411.02
5.2.60.0070.01511.00
5.2.50.0060.01810.98
5.2.40.0040.01710.97
5.2.30.0040.01710.96
5.2.20.0050.01910.96
5.2.10.0060.01510.91
5.2.00.0060.01510.84
5.1.60.0060.01810.48
5.1.50.0070.01510.47
5.1.40.0050.01310.47
5.1.30.0020.01810.64
5.1.20.0040.01610.65
5.1.10.0060.01510.51
5.1.00.0060.01610.49
5.0.50.0030.0139.76
5.0.40.0050.0119.68
5.0.30.0050.0189.59
5.0.20.0030.0129.57
5.0.10.0030.0139.56
5.0.00.0030.0189.55
4.4.90.0050.0088.78
4.4.80.0050.0098.77
4.4.70.0020.0108.77
4.4.60.0050.0078.77
4.4.50.0040.0128.78
4.4.40.0040.0138.75
4.4.30.0030.0138.77
4.4.20.0040.0088.82
4.4.10.0030.0138.82
4.4.00.0050.0148.77
4.3.110.0040.0178.73
4.3.100.0020.0108.73
4.3.90.0030.0078.71
4.3.80.0030.0138.69
4.3.70.0040.0078.71
4.3.60.0030.0098.71
4.3.50.0030.0098.71
4.3.40.0050.0138.66
4.3.30.0030.0078.05
4.3.20.0010.0108.04
4.3.10.0040.0078.01
4.3.00.0110.0159.97

preferences:
44.86 ms | 401 KiB | 5 Q