Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP String strrev() function is used to return 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 below example, strrev() function is used to return 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