note 80979 added to function.str-split

From: Date: Sat, 09 Feb 2008 11:04:35 +0000
Subject: note 80979 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-135929@lists.php.net to get a copy of this message
Don't use count() or strlen() directly in for, while, etc. as it is performed in every loop! Besides I'm using this version: if( !function_exists('str_split') ) { function str_split($string, $split_length=1) { $array = array(); $len = strlen($string); do { $part = ''; for ($j = 0; $j < $split_length; $j++) { $part .= $string{$i}; $i++; } $array[] = $part; } while ($i < $len); return $array; } } ---- Server IP: 217.160.72.57 Probable Submitter: 88.76.36.114 ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/80979 Del: integrated -- https://master.php.net/note/delete/80979/integrated Del: useless -- https://master.php.net/note/delete/80979/useless Del: bad code -- https://master.php.net/note/delete/80979/bad+code Del: spam -- https://master.php.net/note/delete/80979/spam Del: non-english -- https://master.php.net/note/delete/80979/non-english Del: in docs -- https://master.php.net/note/delete/80979/in+docs Del: other reasons-- https://master.php.net/note/delete/80979 Reject -- https://master.php.net/note/reject/80979 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135929) next »