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
https://forums.phpfreaks.com/topic/221214-which-mode-of-count_chars-do-i-need/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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