note 62854 added to function.str-split

From: Date: Fri, 10 Mar 2006 22:07:10 +0000
Subject: note 62854 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-105245@lists.php.net to get a copy of this message
I think that the last post by carlosreche at yahoo dot com is too complicated. It's much easier if you do it like this: <?php if (!function_exists("str_split")) { function str_split($str,$length = 1) { if ($length < 1) return false; $strlen = strlen($str); $ret = array(); for ($i = 0; $i < $strlen; $i += $length) { $ret[] = substr($str,$i,$length); } return $ret; } } ?> I hope it helps for those with PHP <5 ---- Server IP: 66.163.161.117 Probable Submitter: 200.107.2.83 ---- 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/62854 Del: integrated -- http://master.php.net/note/delete/62854/integrated Del: useless -- http://master.php.net/note/delete/62854/useless Del: bad code -- http://master.php.net/note/delete/62854/bad+code Del: spam -- http://master.php.net/note/delete/62854/spam Del: non-english -- http://master.php.net/note/delete/62854/non-english Del: in docs -- http://master.php.net/note/delete/62854/in+docs Del: other reasons-- http://master.php.net/note/delete/62854 Reject -- http://master.php.net/note/reject/62854 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105245) next »