note 42008 added to function.str-split

From: Date: Wed, 28 Apr 2004 22:51:27 +0000
Subject: note 42008 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-68978@lists.php.net to get a copy of this message
Please delete my former post. It contains bugs. here is the right one: <? if (!function_exists('str_split')) { function str_split($str,$chunk_size = 1) { if (!is_string($str)|| !is_numeric($chunk_size) || $chunk_size < 1) { return false; } $n = intval(ceil(strlen($str)/$chunk_size)); $a = array(); echo $n; for ($i = 1;$i<=$n;$i++) { $a[$i] = substr($str,0,$chunk_size); $str = substr($str,$chunk_size,strlen($str)); } return $a; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42008 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42008&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42008&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#68978) next »