note 38430 added to function.strtok

From: Date: Sun, 21 Dec 2003 01:00:07 +0000
Subject: note 38430 added to function.strtok
Groups: php.notes 
Request: Send a blank email to php-notes+get-62277@lists.php.net to get a copy of this message
Beware! This function cannot be used to start a recursion during the loop. Sh.. You have to collect the results in an array and then cycle the recursion through that array. Example: $word=strtok($line,TOKENS); while ($word) { // DO NOT START RECURSION HERE USING $word PARAMETER $words[] = $word; } foreach( $words as $word ) { *RECURSE*($word); } // This seems very silly but as the function is not instantiated between recursions it cannot work directly. ---- Manual Page -- http://www.php.net/manual/en/function.strtok.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38430 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38430&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38430&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62277) next »