my site is allow users to register with arabic/english names
i am trying to convert user first and last name to lower case
i am using this function
$first_name = strtolower ( $_POST['first_name'] );
if i try to put arabic name i get this encode ( ø¹ù„ø§ø¡ )
try it by your self
<?
echo 'مصر'; // return مصر
echo strtolower('مصر'); // return ø¹ù„ø§ø¡
?>
?>
You can't use strtolower
on UTF-8 encoded string, only on ISO 8859-1. Use mb_strtolower()
instead. You also need to specify the encoding used, make sure it's set correctly (probably "UTF-8"
).
<?
echo 'مصر'; // return مصر
echo mb_strtolower('مصر', 'UTF-8'); // return مصر
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With