PHP count_chars() Function
You are Here:
PHP count_chars()
The count_chars()
function returns information about characters used in a string.
This function counts the number of occurrences of every byte-value (0 to 255) in string and returns it in various ways (depending upon the specified mode parameter).
Example
PHP Compiler
<?php
$str = "PHP world";
echo count_chars($str, 3);
?>
Output
HPdlorw
Syntax
count_chars(str, mode)
Parameter Values
Value | Type | Explanation |
---|---|---|
str | Required | Specifies a string to be examined. |
mode | Optional | Specifies the return modes. The following are the list of different modes:
|
Return Value
Value | Explanation |
---|---|
array | string | The return value depends on the specified mode parameter. |
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on PHP with examples for quick and easy learning.
We are working to cover every Single Concept in PHP.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.