PHP Tutorial PHP Advanced PHP Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

PHP - String strrev() Function



The PHP String strrev() function returns the string that is reverse of the specified string.

Syntax

strrev(string)

Parameters

string Required. Specify the string to reverse

Return Value

Returns the reverse version of the specified string.

Example:

In the example below, strrev() function returns a string which is reverse of the string called MyString.

<?php
$MyString = "HELLO";
$NewString = strrev($MyString);

echo $NewString."\n";
?>

The output of the above code will be:

OLLEH

❮ PHP String functions

5