How to convert unicode to arabic characters in php?

arabic, html, php, unicode

Solution

I found the solution , hope to help:

function uni2arabic($uni_str) 
{   
      for($i=0; $i<strlen($uni_str); $i+=4)
         {
                $new="&#x".substr($uni_str,$i,4).";"; 
                $txt = html_entity_decode("$new", ENT_COMPAT, "UTF-8");
                $All.=$txt;
         }

    return $All;
} 

variable $All contains the arabic string

Problem

let us say that the string is ``` $uni_str="06280628002006280628"; ``` In Arabic,it is: بب بب so , how can i convert it in php without using html like: ``` for($i=0; $i<strlen($uni_str); $i+=4) { $text_str .= "&#x".substr($uni_str,$i,4).";"; } ``` as this code just solves the problem of viewing the result in html page , but i want to but the result in php variable . as the result of the code above was like ``` &#x0628;&#x0628;&#x0020;&#x0020;&#x0628;&#x0628; ```

Original source

Related problems