Jump to content

Which mode of count_chars do I need?


ThisisForReal

Recommended Posts

I'm not a programmer, so sometimes the php.net/manual reads like a foreign language to me.  I have a quick interpretation question:

 

I'm generating data in PHP for a MySQL stored procedure that has two comma separated value inputs.  The second input is always a series of 0's and 1's.  I'm trying to count the number of 1's for the second input (in the example below, it would be "3").

 

Example input sent to MySQL:

$query_resolve = "CALL spParticipant_Test ('188,216,342,81,117,56','0,1,1,0,0,1')";

 

http://www.php.net/manual/en/function.count-chars.php is mostly helpful, but I am hoping for clarification on the mode I want to run.

Depending on mode count_chars() returns one of the following:

 

0 - an array with the byte-value as key and the frequency of every byte as value.

1 - same as 0 but only byte-values with a frequency greater than zero are listed.

2 - same as 0 but only byte-values with a frequency equal to zero are listed.

3 - a string containing all unique characters is returned.

4 - a string containing all not used characters is returned.

 

Do I want to run mode "1"?  Thanks so much for any feedback!

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.