3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '___RN___RN___R___N___RN___RN'; $del = array('RN', 'R', 'N'); # This won't work if delimiters 2-n include characters from delimiter 1 var_dump(explode( $del[0], str_replace($del, $del[0], $str))); # This, however, will work function array_explode($delimiters, $string){ if(!is_array(($delimiters)) && !is_array($string)){ //if neither the delimiter nor the string are arrays return explode($delimiters,$string); } else if(!is_array($delimiters) && is_array($string)) { //if the delimiter is not an array but the string is foreach($string as $item){ foreach(explode($delimiters, $item) as $sub_item){ $items[] = $sub_item; } } return $items; } else if(is_array($delimiters) && !is_array($string)) { //if the delimiter is an array but the string is not $string_array[] = $string; foreach($delimiters as $delimiter){ $string_array = array_explode($delimiter, $string_array); } return $string_array; } } var_dump(array_explode($del,$str));

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.4.10.0090.01219.56
8.3.140.0030.01217.05
8.3.130.0060.00318.43
8.3.120.0130.00318.79
8.3.110.0100.00020.94
8.3.100.0040.00424.06
8.3.90.0000.00826.77
8.3.80.0030.00616.63
8.3.70.0110.01116.63
8.3.60.0090.00618.33
8.3.50.0150.00417.30
8.3.40.0070.00718.82
8.3.30.0120.00318.83
8.3.20.0040.00419.27
8.3.10.0040.00423.36
8.3.00.0080.00023.64
8.2.250.0150.00016.80
8.2.240.0090.00917.36
8.2.230.0160.00022.58
8.2.220.0030.00637.54
8.2.210.0160.00326.77
8.2.200.0060.00316.38
8.2.190.0040.01116.58
8.2.180.0040.01125.92
8.2.170.0070.00722.96
8.2.160.0040.01122.16
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0070.00326.16
8.2.120.0040.00419.77
8.2.110.0100.00020.89
8.2.100.0040.00820.15
8.2.90.0050.00317.97
8.2.80.0080.00018.15
8.2.70.0000.00917.75
8.2.60.0060.00317.63
8.2.50.0000.00817.63
8.2.40.0080.00319.48
8.2.30.0040.00420.57
8.2.20.0070.00018.04
8.2.10.0040.00418.06
8.2.00.0000.00719.48
8.1.300.0090.00917.80
8.1.290.0090.00018.88
8.1.280.0110.00425.92
8.1.270.0060.00318.71
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0030.00619.28
8.1.230.0070.00321.02
8.1.220.0030.00517.78
8.1.210.0000.00818.77
8.1.200.0040.00417.35
8.1.190.0080.00017.23
8.1.180.0050.00618.10
8.1.170.0070.00019.03
8.1.160.0040.00418.88
8.1.150.0030.00518.93
8.1.140.0040.00418.92
8.1.130.0040.00417.46
8.1.120.0030.00517.46
8.1.110.0000.00717.33
8.1.100.0040.00417.29
8.1.90.0000.00717.47
8.1.80.0030.00717.46
8.1.70.0000.00817.44
8.1.60.0000.00817.50
8.1.50.0050.00317.45
8.1.40.0040.00417.54
8.1.30.0070.00317.65
8.1.20.0050.00317.66
8.1.10.0040.00417.46
8.1.00.0030.00517.38
8.0.300.0040.00419.98
8.0.290.0040.00416.75
8.0.280.0070.00018.41
8.0.270.0070.00016.83
8.0.260.0000.00616.81
8.0.250.0030.00316.97
8.0.240.0060.00316.89
8.0.230.0070.00016.84
8.0.220.0030.00316.82
8.0.210.0000.00716.91
8.0.200.0030.00316.84
8.0.190.0040.00416.83
8.0.180.0080.00016.93
8.0.170.0090.00016.96
8.0.160.0040.00416.85
8.0.150.0040.00416.79
8.0.140.0000.00716.82
8.0.130.0000.00613.33
8.0.120.0050.00316.76
8.0.110.0000.00916.80
8.0.100.0040.00416.84
8.0.90.0000.00716.94
8.0.80.0100.00616.87
8.0.70.0070.00016.76
8.0.60.0000.00716.83
8.0.50.0040.00416.96
8.0.30.0090.00717.13
8.0.20.0130.00717.40
8.0.10.0050.00316.93
8.0.00.0130.01816.79
7.4.330.0000.00515.55
7.4.320.0000.00716.52
7.4.300.0000.00716.52
7.4.290.0100.00016.48
7.4.280.0000.00816.42
7.4.270.0030.00316.55
7.4.260.0030.00316.62
7.4.250.0050.00316.45
7.4.240.0000.00716.52
7.4.230.0030.00316.69
7.4.220.0040.00416.34
7.4.210.0080.01016.53
7.4.200.0050.00216.30
7.4.160.0040.01316.61
7.4.140.0100.00917.86
7.4.130.0110.00716.39
7.4.120.0130.00616.52
7.4.110.0120.00916.63
7.4.100.0070.01416.59
7.4.90.0120.01216.55
7.4.80.0150.00319.39
7.4.70.0030.01316.31
7.4.60.0100.00616.36
7.4.50.0110.00316.61
7.4.40.0180.00416.63
7.4.10.0110.00715.02
7.4.00.0120.00714.93
7.3.330.0050.00013.37
7.3.320.0050.00013.21
7.3.310.0030.00716.46
7.3.300.0030.00316.41
7.3.290.0030.00316.30
7.3.280.0120.00516.31
7.3.260.0100.00916.38
7.3.240.0100.01016.47
7.3.230.0080.01116.57
7.3.210.0120.00616.28
7.3.200.0110.00716.65
7.3.190.0100.00916.34
7.3.180.0070.01016.45
7.3.170.0090.00616.46
7.3.160.0100.00716.55
7.3.130.0060.01014.88
7.3.120.0040.01414.91
7.3.110.0060.01114.81
7.3.100.0040.01114.76
7.3.90.0030.01214.96
7.3.80.0080.00414.93
7.3.70.0080.00214.91
7.3.60.0090.00514.91
7.3.50.0020.01114.84
7.3.40.0080.01114.61
7.3.30.0070.00514.54
7.3.20.0180.00315.63
7.3.10.0090.01015.97
7.3.00.0160.00516.13
7.2.330.0080.01516.54
7.2.320.0090.01216.84
7.2.310.0110.00716.79
7.2.300.0100.00716.79
7.2.290.0060.01616.79
7.2.260.0090.00915.23
7.2.250.0070.01115.31
7.2.240.0070.00914.87
7.2.230.0070.00715.11
7.2.220.0030.01114.94
7.2.210.0100.00514.89
7.2.200.0050.01015.01
7.2.190.0050.01115.12
7.2.180.0100.00515.10
7.2.170.0050.01014.95
7.2.160.0060.00914.92
7.2.150.0190.00315.90
7.2.140.0210.00915.94
7.2.130.0080.01016.27
7.2.120.0120.00616.29
7.2.110.0110.00716.36
7.2.100.0100.00816.33
7.2.90.0120.00716.33
7.2.80.0440.00715.85
7.2.70.0380.00916.14
7.2.60.0530.00616.10
7.2.50.0390.00716.10
7.2.40.0450.01116.06
7.2.30.0380.00716.00
7.2.20.0380.00815.98
7.2.10.0410.00816.04
7.2.00.0340.00916.02
7.1.330.0050.01015.82
7.1.320.0090.00415.95
7.1.310.0050.00715.77
7.1.300.0020.01015.72
7.1.290.0050.00715.75
7.1.280.0070.00615.13
7.1.270.0070.00815.13
7.1.260.0090.00515.21
7.1.250.0110.00715.16
7.1.240.0210.01014.84
7.1.230.0200.00914.83
7.1.220.0210.00714.81
7.1.210.0200.00714.77
7.1.200.0590.00714.49
7.1.190.0640.00714.48
7.1.180.0500.00814.54
7.1.170.0500.01014.49
7.1.160.0550.00814.57
7.1.150.0550.00714.54
7.1.140.0550.00614.50
7.1.130.0580.00914.46
7.1.120.0610.00814.52
7.1.110.0500.00714.57
7.1.100.0560.00614.51
7.1.90.0840.00714.52
7.1.80.0640.00614.50
7.1.70.0700.00714.54
7.1.60.0770.00920.46
7.1.50.1140.00720.53
7.1.40.0970.01020.39
7.1.30.1150.01020.40
7.1.20.1030.00720.38
7.1.10.0990.00914.49
7.1.00.0670.00614.62
7.0.330.0220.00914.11
5.6.400.0130.01214.26
5.6.390.0080.01014.25
5.6.380.0150.00614.36

preferences:
69.73 ms | 403 KiB | 5 Q