Re: use of str_split

From: Date: Thu, 09 Aug 2007 12:19:20 +0000
Subject: Re: use of str_split
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43895@lists.php.net to get a copy of this message
Asim wrote:
Hi when i try to use this function str_split() it shows me as invalid function
Are you using PHP 5? That function does not exist in PHP 4.
what is solution i want to split certain length of string into an array
// NB: UNTESTED $string = 'This is a string'; $certainlength = 5; $pos = 0; $stringlen = strlen($string); $array = array(); while ($pos < $stringlen) { $array[] = substr($string, $pos, $certainlength); $pos += $certainlength; } // $array now contains an element for every $certainlength characters // in $string -Stut -- http://stut.net/

« previous php.db (#43895) next »