[PHP] strtok()
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( ); echo $token.br; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 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 PROTECTED]) wrote: 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( ); echo $token.br; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strtok()
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
Re: [PHP] strtok()
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 = strtok($string,); while ($tok) { echo {$tok}br; $tok = strtok(); } ? Justin on 11/06/02 1:58 PM, Anthony Ritter ([EMAIL PROTECTED]) wrote: 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
[PHP] strtok bug
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! http://promo.yahoo.com/videomail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] strtok bug
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 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! http://promo.yahoo.com/videomail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] strtok not working...
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 exactly what I want... why doesn't strtok() works here? . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]