Trying to test the function strtok()
I thought that the following script would output:
t
o
n
y
but I get
tony
Thanking all in advance.
Tony Ritter
.
?
$name=tony;
$token=strtok($name, );
echo $token.br;
while ($token!=)
$token=strtok( );
you're trying to split it on a space ( )... there are no spaces in tony.
my name is tony would prolly output
my
name
is
tony
You could try splitting on (nothing), or use a different function which
places a br after each character.
Justin
on 11/06/02 1:34 PM, Anthony Ritter ([EMAIL
Thank you.
The output is
t
o
n
y
One thing...the server seem to keep running after the output to the browser
like it's going through an indefinate loop.
Any throughts?
TR
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I *think* it's because you don't have an { at the beginning of the while()
loop
?
$name=tony;
$token=strtok($name, );
//echo $token.br;
while ($token!=)
{
$token=strtok( );
echo $token.br;
}
?
Or, use the example in the manual as a guide:
?
$string = tony;
$tok =
Hi, does anybody know when the strtok bug introduced
in 4.1.1 will be fixed ?
Will we have a 4.1.2 or should I try to grab a cvs
tree (assuming that it is already solved) ?
thanks.
__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
Are you referring to the change with 4.1.0 that's documented in the
manual? Have another look, it gives examples of new/old behavior:
http://www.php.net/strtok
Regards,
Philip Olson
On Sun, 13 Jan 2002, Robert Mena wrote:
Hi, does anybody know when the strtok bug introduced
in 4.1.1
I have a chunk of text like this:
$string="bla bla bla (12837) ble blo bli sjhs9 39udjkd";
I only want "bla bla bla" out of it...
what is wrong with:
$newString = strtok ($string,"(128");
altough this seems to work:
$newStrArray = explode("(128",$string);
so $newStrArray[0] would have
7 matches
Mail list logo