php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15347 strtok multiple string handling
Submitted: 2002-02-03 03:47 UTC Modified: 2011-01-01 00:35 UTC
From: dave at compunexus dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.0CVS-2002-02-03 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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 00:35 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2011-01-01 00:35 UTC] jani@php.net
Incomprehensible request.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 10 21:01:29 2024 UTC