PHP Strrev () function

PHP

The strrev()function is built into PHP and is used to reverse a string. This function does not make any changes to the original string passed to it as a parameter.Synatx:
string strrev ($inpString)
Parameter:This function takes one parameter $inpString. This parameter is a string and defines the string that we want to change. If passed a number instead of a string, it will reverse that number as well.Returned value:The strrev() function returns the reverse of a string or number. It does not make any changes to the original string or the number passed in the parameter.Examples:
Input: $string = "engineer" Output: skeeg Input: $string = 143 Output: 341
The following programs illustrate the strrev() function in PHP:Program 1:PHP program to demonstrate the strrev() function when passing a string.
// PHP demo program
// strrev() function when passing a string $str = "engineer" ;  
// prints back line echo strrev ( $str ); ?>
Output:
skeeg
Program 2:PHP program to demonstrate the strrev() function when passing a number.
// PHP program for demonstration
// strrev() function when passing a number 
// passing a number instead of a string $num = 134;  
// prints the reverse number echo strrev ( $num ); ?>
Output:
431
Link :
http://php.net/manual/ en / function.strrev.php



Get Solution for free from DataCamp guru