Skip to content

Instantly share code, notes, and snippets.

@ArtemSites
Created August 27, 2019 10:00
Show Gist options
  • Save ArtemSites/18e555f6ded083541c3c830ad363f7f5 to your computer and use it in GitHub Desktop.
Save ArtemSites/18e555f6ded083541c3c830ad363f7f5 to your computer and use it in GitHub Desktop.
PHP функция мультирасчленения строки в массив по любому набору вхождений подстрок.
function multiexplode ($delimiters,$string) {
$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
$text = "here is a sample: this text, and this will be exploded. this also | this one too :)";
$exploded = multiexplode(array(",",".","|",":"),$text);
print_r($exploded);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment