Created
August 27, 2019 10:00
-
-
Save ArtemSites/18e555f6ded083541c3c830ad363f7f5 to your computer and use it in GitHub Desktop.
PHP функция мультирасчленения строки в массив по любому набору вхождений подстрок.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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