note 84054 deleted from function.strtok by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:01:47 +0000 |
| Subject: | note 84054 deleted from function.strtok by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197033@lists.php.net to get a copy of this message | ||
Note Submitter: magne
----
Quick and dirty function to tokenize:
function stringTokenize($sBuffer, $sSplit) {
$iCount = 0;
if(strlen($sBuffer) == 0)
return;
$sToken = strtok($sBuffer, $sSplit);
$aTokens[$iCount] = $sToken;
while ($sToken !== false) {
$sToken = strtok($sSplit);
if(strlen($sToken) > 0) {
$iCount++;
$aTokens[$iCount] = $sToken;
}
} // end while
return $aTokens;
}