note 79921 added to function.str-split

From: Date: Wed, 19 Dec 2007 19:22:27 +0000
Subject: note 79921 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-133790@lists.php.net to get a copy of this message
The previous suggestion is almost correct (and will only working for strlen=1. The working PHP4 function is: <code> function str_split($text, $split = 1){ //place each character of the string into and array $array = array(); for ($i=0; $i < strlen($text); $i++){ $key = ""; for ($j = 0; $j < $split; $j++){ $key .= $text[$i+$j]; } $i = $i + $j - 1; array_push($array, $key); } return $array; } </code> ---- Server IP: 213.249.64.162 Probable Submitter: 85.149.80.40 ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/79921 Del: integrated -- https://master.php.net/note/delete/79921/integrated Del: useless -- https://master.php.net/note/delete/79921/useless Del: bad code -- https://master.php.net/note/delete/79921/bad+code Del: spam -- https://master.php.net/note/delete/79921/spam Del: non-english -- https://master.php.net/note/delete/79921/non-english Del: in docs -- https://master.php.net/note/delete/79921/in+docs Del: other reasons-- https://master.php.net/note/delete/79921 Reject -- https://master.php.net/note/reject/79921 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#133790) next »