note 80195 added to function.str-split
| From: | Anonymous at osu1 dot php dot net | Date: | Thu, 03 Jan 2008 20:04:36 +0000 |
| Subject: | note 80195 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134729@lists.php.net to get a copy of this message | ||
Version of str_split by rlpvandenberg at hotmail dot com is god-damn inefficient and when $i+$j >
strlen($text) [last part of string] throws a lot of notice errors. This should work better:
if(! function_exists('str_split'))
{
function str_split($text, $split = 1)
{
$array = array();
for ($i = 0; $i < strlen($text);)
{
$array[] = substr($text, $i, $split);
$i += $split;
}
return $array;
}
}
----
Server IP: 82.177.164.100
Probable Submitter: 80.53.26.126
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit -- https://master.php.net/note/edit/80195
Del: integrated -- https://master.php.net/note/delete/80195/integrated
Del: useless -- https://master.php.net/note/delete/80195/useless
Del: bad code -- https://master.php.net/note/delete/80195/bad+code
Del: spam -- https://master.php.net/note/delete/80195/spam
Del: non-english -- https://master.php.net/note/delete/80195/non-english
Del: in docs -- https://master.php.net/note/delete/80195/in+docs
Del: other reasons-- https://master.php.net/note/delete/80195
Reject -- https://master.php.net/note/reject/80195
Search -- https://master.php.net/manage/user-notes.php