Home > Backend Development > PHP Tutorial > How to use php strrev

How to use php strrev

藏色散人
Release: 2023-04-06 18:58:01
Original
3429 people have browsed it

php The strrev() function is used to reverse a string and return the reversed string. The syntax is "strrev(string)", and the parameter string specifies the string to be reversed. The strrev() function does not change the original string passed to it as an argument; if a number is passed to the function as an argument, it will reverse the number.

How to use php strrev

How to use strrev()?

Function: Reverse a string

Syntax:

strrev(string)
Copy after login

Parameters:

string Necessary, specify to reverse The converted string.

Description: Return the reversed string.

php strrev() function example 1

<?php
$i = "hello world";
$j = strrev($i);
echo $j;
?>
Copy after login

Output:

dlrow olleh
Copy after login

php strrev() function example 2

<?php
$i = "I&#39;m study php in php.cn";
$j = strrev($i);
echo $j;
?>
Copy after login

Output:

nc.php ni php yduts m&#39;I
Copy after login

The above is the detailed content of How to use php strrev. 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