note 42008 deleted from function.str-split by aidan

From: Date: Tue, 01 Jun 2004 06:18:38 +0000
Subject: note 42008 deleted from function.str-split by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70391@lists.php.net to get a copy of this message
Note Submitter: tmpfreire@terra.com.br ---- 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; } } ?>

« previous php.notes (#70391) next »