Explode (split) a string on multiple delimiters

March 20, 2014 at 2:34 pm

This is the most elegant solution I’ve found so far:

function explodeX($delimiters,$string) {
return explode(chr(1),str_replace($delimiters,chr(1),$string));
}