How to use php strlen function

藏色散人
Release: 2023-04-05 06:56:01
Original
3562 people have browsed it

The strlen function is a built-in function in PHP. The syntax is strlen(string), which is used to obtain the length of a string. This function calculates the length of a string, including all spaces and special characters; it takes the given string as an argument and returns its length.

How to use php strlen function

php How to use strlen() function?

php strlen() function returns the length of the string

Syntax:

strlen(string)
Copy after login

Parameters:

string: required. Specifies the string to check.

Return value: Returns the length of the string.

php strlen() function example 1

<?php
echo strlen("I love php!");
?>
Copy after login

Output:

11
Copy after login

php strlen() function example 2

<?php
echo strlen("i study php at php.cn");
?>
Copy after login

Output:

21
Copy after login

This article is an introduction to the PHP strlen function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use php strlen function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template