Level 30
did you try something like this ?
$western_arabic = array('0','1','2','3','4','5','6','7','8','9');
$eastern_arabic = array('٠','١','٢','٣','٤','٥','٦','٧','٨','٩');
$str = str_replace($western_arabic, $eastern_arabic, $str);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i want to display dates in Arabic in my web app. I'm using diffForHumans().
<?php Carbon::setLocale('ar'); ?>
{{$post->created_at->diffForHumans()}}
\\Output
منذ 5 ساعة
diffForHumans() works right but i want also 5 wil be in Arabic Numeral.
منذ ٥ ساعة \\ I was expecting this output
How can I do this? Thanks.
Please or to participate in this conversation.