Sunday 28 March 2021

php: strrev: Reverse a string

Signature

strrev ( string $string ) : string

 

Description

Returns the reversed string.

 

Example

$rev_str = strrev($str1);

 

strrev_demo.php

#!/usr/bin/php

<?php

   $str1 = 'Hello';
   $rev_str = strrev($str1);
   
    echo "\$str1: $str1\n";
    echo "\$rev_str: $rev_str\n";
   
?>

 

Output

$./strrev_demo.php 

$str1: Hello
$rev_str: olleH

 

   

Previous                                                    Next                                                    Home

No comments:

Post a Comment