PHP strrev() string function



The strrev() function in PHP

The strrev() function used to returns a reverses character of given string.

strrev() function syntax

strrev(“string”);

PHP strrev() function example

<?php
echo "The Revers string of given string = ". strrev("Hello Meera Academy");
?>

The out put is :

The Revers string of given string = ymedacA areeM olleH

PHP form example of strrev() string function

<html>
<head>
<title>PHP strrev() Function</title>
</head>
<body>

<FORM method="POST" action="firstexample.php">

Name : <input type="text" name="name"> <br/><br/>
<input type="submit" name="Submit1" value="Revers String">

</FORM>

<?php
if(isset($_POST['Submit1']))
{
echo "The Revers string of given string = ". strrev($_POST["name"]);
}
?>

</body>
</html>

The out put of php strrev() function example is :

PHP strrev() string function
PHP strrev() string function

Leave a Reply

Your email address will not be published. Required fields are marked *