Home >Backend Development >PHP Tutorial >Function of strlen function in php
strlen function returns the length of the string (number of bytes). The specific usage is as follows: strlen($string): Calculate the length of $string. For multibyte character sets, a character may consist of multiple bytes. If $string is the empty string, strlen returns 0. If $string is not a string, strlen will raise a TypeError exception.
strlen function
Function:
strlen function returns the length of the string (number of bytes).
Usage:
<code class="php">strlen($string);</code>
Among them, $string is the string whose length is to be calculated.
Example:
<code class="php">$string = "Hello World"; $length = strlen($string); // 11</code>
Note:
The above is the detailed content of Function of strlen function in php. For more information, please follow other related articles on the PHP Chinese website!