note 10500 added to strtok
| From: | mxq at supergamez dot hu | Date: | Mon, 08 Jan 2001 04:55:46 +0000 |
| Subject: | note 10500 added to strtok | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9460@lists.php.net to get a copy of this message | ||
strtok () cannot always be fully replaced by explode. You may only need the first several tokens
from a long string, then do not use explode to explode the whole string - you just waste time.
strtok () seemed not to work when I tried to put the result into the same variable as I used for
arg1 (for e.g., $strx = strtok ($strx, "."); simply made $strx be empty). This must be
something with the pointer used. Use of an auxiliary string is needed so something like this $aux =
strtok ($strx, "."); $strx = $aux;
http://www.php.net/manual/function.strtok.php