note 51160 added to function.str-split
| From: | Sdb at hl2-bg dot net | Date: | Tue, 22 Mar 2005 12:25:31 +0000 |
| Subject: | note 51160 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86774@lists.php.net to get a copy of this message | ||
I made a simulation of that function:
function myStringSplit($string, $long){
$long--;
// Converting the string into an array
For( $i=0; isset($string{$i}); $i++){
$myarray[] = $string{$i};
}
// Making arrays from the array
$a=0;
$end = $long;
$iend = count($myarray) / ( $long + 1 );
For( $i=0; $i<$iend; $i++){
For( ; $a<=$end; $a++){
$array[$i] = $array[$i].$myarray[$a];
}
$end = $end + $long + 1;
}
return $array;
}
$test = "123456789";
$splited = myStringSplit2($test, '3');
print_r($splited);
Should return this:
Array (
[0] => 123
[1] => 456
[2] => 789
)
btw: It's mixed-up but it works :)
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51160
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51160&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51160&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51160&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51160&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51160&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51160&report=yes
Search -- http://master.php.net/manage/user-notes.php