Home >Backend Development >PHP Problem >What is the php strlen method?

What is the php strlen method?

藏色散人
藏色散人Original
2021-11-23 10:38:392163browse

php The strlen method is used to return the length of a string. The syntax for using this function is "strlen(string)", where the parameter string specifies the string to be checked.

What is the php strlen method?

#The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.

php What is the strlen method?

strlen() function returns the length of the string.

Syntax

strlen(string)

Note: Before PHP 5.3.0, this function treated the array as a string Array, thus returning a string of length 5 and generating an E_NOTICE level error. .

Parameter string required. Specifies the string to check.

Example

Return the length of the string "I love Shanghai!":

<?php
echo strlen("I love Shanghai!");
?>

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the php strlen method?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn