strrev(): PHP String Reverse

echo strrev($input_string);
$input_string: Input string to be reversed
Output is the string after reversing input string.

The origial ( input string ) remains same.

We can reverse any string by applying strrev() function. Here is what a normal string will look like.
The string = This is a test
The new string after applying the strrev function is here
 tset a si sihT

Here is the code
$st="This is a test";
echo "The string = ".$st."<br>";
$st=strrev($st);
echo "The new string after applying the strrev function = ".$st."<br>";

Printing the string in reverse without using strrev() function.

Here is the code.
<?Php
$st="Hello world";
//echo $st[4];
$length=strlen($st);
for($i=$length-1;$i>=0;$i--){
echo $st[$i];
}
?>
Output is here
dlrow olleH
This function support utf-8 encoding and does not work with unicode strings.
Visitors Rating
Your Rating





PHP String Functions
huzoor

23-04-2012

Nice Collection.. I feel very happy

Post your comments , suggestion , error , requirements etc here .




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer