PHP program to reverse a string:
The below program can be used to reverse a given string using a loop. The PHP echo statement is used to output the result on the screen.
Reverse String of abcde = edcba.
Example
<!DOCTYPE html> <html> <body> <?php $string = "MIRROR IMAGE"; echo "$string : " .strrev ( $string ); ?> </body> </html> |
Output
MIRROR IMAGE : EGAMI RORRIM |
Please Share