
Useful PHP function Nr.2 - Reverse substring with delimiter - azwebcoder
http://webcoderblog.com/2009/06/14/useful-php-function-nr-2-reverse-substring-with-delimiter/
======
shaunxcode
That is what I would call "not so much". PHP is inherently ugly but this is
just excessive. Temporary variables, needless loops, off by one logic errors
compensated for with extra substr call. yuck. How about:

return join($delim, array_reverse(split($delim, $str)));

Or more ideally with a little fluidity, assuming a string object:

return $str->split($delim)->reverse()->join($delim);

