PHP strrev Function | Reverse a String in PHP

PHP strrev is an inbuilt function in PHP which reverses the input string. It takes a string in the parameter and returns the reverse of that string. In this article, we will discuss the PHP strrev Function. Also, we will discuss a few examples of using it.

Syntax

strrev ($input_string);

Parameters

The function expects one parameter. The input string which you want to reverse is passed as the parameter.

Return Value

The function returns the reverse of the input string.

PHP strrev Function

Example

<?php

    $inputString = 'Hello World!';
    $reverseString = strrev($inputString);
?>

In the above example, the function returns the reverse of the string.

OUTPUT:
!dlroW olleH

Conclusion

You can read more about PHP strrev on the Official Documentation of PHP. Additionally, you can read more about PHP String Functions on Concatly.

Spread the Knowledge

Leave a Reply

Your email address will not be published. Required fields are marked *