Introduction
In this article I describe the PHP string functions count_chars, crc32 and explode. To learn some other math functions, go to:
PHP count_chars() Function
The PHP string count_chars function returns information about the characters used in a string.
Syntax
| count_chars (string, node) |
Parameter in count_chars Function
The parameters of the count_chars function are:
| Parameter | Description |
| string | It specifies the string to be checked. |
| mode | It specifies the returns mode. The returns mode are: 0: An array with the byte-value as key and the frequency of every byte as value. 1: Same as 0 but only byte-value with a frequency greater than zero are listed. 3: Same as 0 but byte value with a frequency equal to zero are listed. 4: A string containing all unique characters is returned. 5: A string containing all unused characters is returned. |
Example
An example of the count_chars function is:
<?php
$str="MCN Solution";
echo "<pre>";
print_r( count_chars($str,1));
?>
Output
PHP crc32() Function
The PHP string crc32 function calculates the crc32 polynomial of a string. This function can be used to validate data integrity.
Syntax
| crc32(string) |
Parameter in crc32 Function
The parameter of the crc32 function is:
| Parameter | Description |
| string | It specifies the string to be calculate. |
Example
An example of the crc32 function is:
<?php


Join the conversation! Your thoughts help the community grow.