php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15348 strtok multiple string handling
Submitted: 2002-02-03 03:47 UTC Modified: 2002-02-10 00:09 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dave at compunexus dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0CVS-2002-02-0 OS: mandrake 8.0
Private report: No CVE-ID: None
 [2002-02-03 03:47 UTC] dave at compunexus dot com
just a quick example of one think I'd like to do, I 
figured out why it was failing, it was just toking the 
last string twice instead of each string once.  I suspect 
it would require an extra parameter, but I'd like the 
feature anyways....

Thanks

$field_display_tok = strtok ( "$field_display", ',' );
  $field_val_tok = strtok ( "$field_val", ',' );
 
  // still need to set type properly
  while ( $field_display_tok && $field_val_tok )
  {
//    printf ( "field_edval:  $field_edval, fieldval_tok:  
$fieldval_tok\n");
    if ( $field_edval == $field_val_tok )
      printf ( "    <option value = \"" . 
$field_display_tok . "\" selected>" . $field_display_tok . 
"\n" );
    else
      printf ( "    <option value = \"" . 
$field_display_tok . "\">" . $field_display_tok . "\n" );
 
    $field_display_tok = strtok(",");
    $field_val_tok = strtok(",");
     printf ( "field_edval:  $field_edval, fieldval_tok:  
$field_val_tok\n");
  }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-10 00:09 UTC] jimw@php.net
Please do not submit the same bug more than once.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 18:01:35 2024 UTC