Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
echo strrev("String"); //gnirtS
As for UTF-8 ( echo strrev("Строка"); //�коЀтѡ�
), you can play with the encoding:
function str_reverse($string){
return iconv('utf-16be', 'utf-8', strrev(
iconv('utf-8', 'utf-16le', $string)
));
}
function str_reverse($string){
return implode("", array_reverse(
str_split($string)
));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question