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 an Intermediate Software Engineer with Orion Health, New Zealand. He graduated with a Masters in Information Technology from the University of Auckland in 2021. With more than 4 years of work experience, his expertise includes Java, Python, Machine Learning, PHP, Databases, Design and Architecture.