note 63612 added to function.str-split
| From: | user at mockme dot com | Date: | Sat, 25 Mar 2006 13:53:50 +0000 |
| Subject: | note 63612 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106591@lists.php.net to get a copy of this message | ||
found this great example on a php board for those not using php5, as an alternative to the posts
below this
<?php
if(!function_exists('str_split')){
function str_split($string,$split_length=1){
$count = strlen($string);
if($split_length < 1){
return false;
} elseif($split_length > $count){
return array($string);
} else {
$num = (int)ceil($count/$split_length);
$ret = array();
for($i=0;$i<$num;$i++){
$ret[] = substr($string,$i*$split_length,$split_length);
}
return $ret;
}
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 65.29.93.164
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit -- http://master.php.net/note/edit/63612
Del: integrated -- http://master.php.net/note/delete/63612/integrated
Del: useless -- http://master.php.net/note/delete/63612/useless
Del: bad code -- http://master.php.net/note/delete/63612/bad+code
Del: spam -- http://master.php.net/note/delete/63612/spam
Del: non-english -- http://master.php.net/note/delete/63612/non-english
Del: in docs -- http://master.php.net/note/delete/63612/in+docs
Del: other reasons-- http://master.php.net/note/delete/63612
Reject -- http://master.php.net/note/reject/63612
Search -- http://master.php.net/manage/user-notes.php