You are here

4 January 2016

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
  1. // Split string into an array by multiple delimiters.
  2. $array = preg_split( '/(,|;)/', $string);
  3. // Print results.
  4. print_r($array);
Programming Language: PHP