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.
The function expects one parameter. The input string which you want to reverse is passed as the parameter.
The function returns the reverse of the input string.
Input: strrev('Hello World!') Output: !dlroW olleH
<?php $inputString = 'Hello World!'; $reverseString = strrev($inputString); ?>
In the above example, the function returns the reverse of the string.
OUTPUT: !dlroW olleH
Vishesh is currently working as a Lead Software Engineer at Naukri.com. He passed out of Delhi College of Engineering in 2016 and likes to play Foosball. He loves traveling and is an exercise freak. His expertise includes Java, PHP, Python, Databases, Design and Architecture.