pTutorial

New way to learn PHP function

PHP Strrev() function

Syntax

strrev(string) ;   
Parameter Description
String Any String (Required)

Definition

It returns the reverse of string.

Usage

Strrev function is used to reverse the string. For example java is a string, strrev function return avaj.

Example of strrev function

<?php

echo strrev("Welcome to PHP");

?>

In above example Welcome to PHP is a simple string, pass this string into the strrev function and its return the reverse of the string.

Reverse number using strrev

<?php

$a=387;

$b=strrev(123);

echo $b;

?>

Output

321

You can also use strrev function to reverse the number as shown above.

More example of strrev function

<?php

echo "Before reverse:
"; $a="Hypertext pre-processor"; echo $a."
"; echo "The reverse string :
"; echo strrev($a); ?>

In above example $a is a string variable, you can see the result before and after using strrev function.

QUOTES OF THE DAY

Knowledge without integrity is dangerous and dreadful.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER