note 104489 deleted from function.str-split by danbrown
| From: | danbrown@php.net | Date: | Mon, 20 Jun 2011 15:40:39 +0000 |
| Subject: | note 104489 deleted from function.str-split by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180791@lists.php.net to get a copy of this message | ||
Note Submitter: php_net at mcdragonsoftware dot com
----
self correction:
cannot strrev() the array... have to temporarily rejoin it first...
// $del should be a "safe" delimiter for the text
function str_rsplit( $str, $len, $del ) {
return explode( $del, strrev(implode( $del, str_split( strrev($str), $len ))));
}
usage:
// a string that is highly unlikely to be in the text to
split
$REV = str_rsplit( $string, 4, "ogga-booga !^*&^#$@\n\r\n\n" )