3v4l.org

run code in 300+ PHP versions simultaneously
<?php function explodeCustom($delimiter, $string) { $arr = array(); $deli_strlen = strlen($delimiter); while ($string) { $pos = strpos($string, $delimiter); if ($pos === false) { $arr[] = $string; $string = ''; } else { $arr[] = substr($string, 0, $pos); $string = substr($string, $pos + $deli_strlen); } } return $arr; } print_r(explodeCustom('aa', ',,aaa,,a,a,aa,')); print_r(explode('aa', ',,aaa,,a,a,aa,'));

preferences:
35.31 ms | 402 KiB | 5 Q