PHP Tutorial - PHP strrev() Function






Definition

The strrev() function reverses a string.

Syntax

PHP strrev() Function has the following syntax.

strrev(string)

Parameter

ParameterIs Required Description
stringRequired. String to reverse

Return

PHP strrev() function returns the reversed string.

Example

Reverse the string "java2s.com!":


<?php
echo strrev("java2s.com!");
?>

The code above generates the following result.