This answer is going to be far less efficient than using
explode(). I would not put this in any professional script. If it is possible for your incoming string to be empty, then write a simple falsey check before exploding instead of using a
preg_ call containing a literal character. If a string might have a trailing delimiter and you don't want that, then just
rtrim() the delimiter off -- again, no reason to lean on regex (and I love regex).