Split a string by another string (PHP)

  • Posted on: 29 December 2016
  • By: jmu

EXPLODE (array)

// Example 1
$string = "string1-string2";
$strings = explode("-", $string);
echo $strings[0]; // strings1
echo $strings[1]; // strings2
English