I have no clue why strtok decided to break on me. Here is my code. I am tokenizing a string by dollar symbol $.
echo 'Tokenizing this by $: ',$aliases,PHP_EOL;
if(strlen($aliases) > 0)
{
//aliases check
$token = strtok($aliases, '$');
while($token != NULL)
{
echo 'Found a token: ',$token,PHP_EOL;
if(!isGoodLookup($token))
{
echo 'ERROR: Invalid alias found.',PHP_EOL;
stop($db);
}
$goodAliasesList[] = $token;
$token = strtok('$');
}
if($token == NULL)
echo 'Found null token, moving on',PHP_EOL;
}
And this is my output:
Tokenizing this by $: getaways$aaa
Found a token: getaways
Found null token, moving on
strtok is not supposed to do this!! where is my aaa token!!