PHP strrev

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : strrev() function

Description

The strrev() function is used to reverse a string.

Version

(PHP 4 and above)

Syntax

strrev(main_string)

Parameter

Name

Description

Required /
Optional

Type

main_string

The string to be reversed.

Required

String

Return value

The reversed string.

Value Type : String.

Pictorial Presentation

string_strrev

Example :

  1. $main_string='w3resource.com';  

  2. echo strrev($main_string);  

  3. ?>  

Output :

moc.ecruoser3w