// string reverse_characters(string str)
// Reverse all of the characters in a string.
function reverse_characters ($str)
{
return implode ("", array_reverse (preg_split("//", $str)));
}
?>
的可读性不强,可改成:
<?php
// string reverse_characters(string str)
// Reverse all of the characters in a string.
function reverse_characters ($str)
{
$characters = preg_split ("//", $str);
$characters = array_reverse ($characters);