To explode multiple delimiters PHP you have to use regular expression. Add your delimiters in the parentheses separated by pipe. You might have to escape your characters if they have meaning in PCRE regular expression syntax.
Source code viewer
- // Split string into an array by multiple delimiters.
- $array = preg_split( '/(,|;)/', $string);
- // Print results.
- print_r($array);Programming Language: PHP