strrev() function in PHP


The strrev() function is used to reverse a string. It returns the reversed string.

Syntax

strrev(str)

Parameters

  • str − The string to be reversed

Return

The strrev() function returns the reversed string.

Example

The following is an example −

 Live Demo

<?php
   echo strrev("Jack");
?>

Output

The following is the output −

kcaJ

Example

Let us see another example −

 Live Demo

<?php
   $val = 7837;
   echo strrev($val);
?>

Output

The following is the output −

7387

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 26-Dec-2019

177 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements