RosettaCodeData/Task/Reverse-a-string/PHP/reverse-a-string-2.php

3 lines
171 B
PHP
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
// Will split every Unicode character to array, reverse array and will convert it to string.
join('', array_reverse(preg_split('""u', $string, -1, PREG_SPLIT_NO_EMPTY)));