Jump to: navigation, search

Php strrev

From w3cyberlearnings

Contents

PHP function strrev

This function reverses a string.

Syntax strrev

  • string: string input
strrev(string)

Return

Return the reverse string.

Example 1

<?php

$str='yoB dna lriG';

echo strrev($str);
?>

Output

Girl and Boy

Example 2: Reverse all the Array List elements using strrev() functions

<?php

$aa_fruits = array('coconut', 'mango', 'apple', 'banana', 'orange');

$fruits_reverse = array_map('strrev', $aa_fruits);
foreach($fruits_reverse as $f){
    echo $f .'<br/>';
}
?>


Output

tunococ
ognam
elppa
ananab
egnaro

Related Functions


Navigation
Web
SQL
MISC
References