Jump to content

loclan

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by loclan

  1. [!--quoteo(post=361588:date=Apr 4 2006, 11:00 AM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Apr 4 2006, 11:00 AM) [snapback]361588[/snapback][/div][div class=\'quotemain\'][!--quotec--] Maybe...? [code] $i = 0; while ($my_token) {   $tmp[$i] = $my_token;   if ($my_token == 'string') {     $previous = $tmp[$i-1];   }   $i++; } [/code] A bit messy but hey... [/quote] Hmm... yeah, that should work - messy, but should work. If anyone knows a cleaner solution, much appreciated.
  2. Ok, this has stumped me for the day (and the day has just started): $my_string = "This is a test string"; $my_token = strtok ($my_string, " "); while ($my_token) { do something... [b][i]MY QUESTION: let's say, the current $my_token is now "string". How do I check if the previous $my_token is actually "test"?[/i][/b] $my_token = strtok(" "); } I know, I could have used the "for loop" to make things simpler - but I didn't ;-) Thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.