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));
Output for git.master_jit, git.master, rfc.property-hooks
array(11) { [0]=> string(4) "___R" [1]=> string(0) "" [2]=> string(4) "___R" [3]=> string(0) "" [4]=> string(4) "___R" [5]=> string(3) "___" [6]=> string(4) "___R" [7]=> string(0) "" [8]=> string(4) "___R" [9]=> string(0) "" [10]=> string(0) "" } array(7) { [0]=> string(3) "___" [1]=> string(3) "___" [2]=> string(3) "___" [3]=> string(3) "___" [4]=> string(3) "___" [5]=> string(3) "___" [6]=> string(0) "" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
68.74 ms | 406 KiB | 5 Q