Hello everyone,

When i try to write a string in non english using php it gets written in the opposite direction, for example:
if i write: "example", it'll write "elpmaxe"

So i wanna build an php function which will correct the string to be "example"

Anyone can help me on this?
I've tried the following, but it didnt work.

Code:
function reorder_string($str)
{
	$j = mb_strlen('UTF-8', $str);
	for ($i = 0;$i < $j;$i++,$j--)
	{
		$temp = $str[$i];
		$str[$i] = $str[$j];
		$str[$j] = $temp;
	}
	return $str;
}