I need to replace the characters 0,1,2,...,9 with \xD9\xA0,\xD9\xA1,\xD9\xA2,...,\xD9\xA9 in a string. This string comes from the CKEditor so it may contains html tags. Using the following code
$body = str_replace("1", "\xD9\xA1", $body);
it replaces every 1 with \xD9\xA1 so it effects the tag <h1> and also <table border="1"> while I only need to replace the numbers in the body not the tags.
The tags that contain numbers are <h0><h1><h2><h3><h4><h5><h6> and cellspacing and cellpadding and border of table tag.
How do I can replace the numbers with the above symbols while it won't effect the <h0><h1><h2><h3><h4><h5><h6>and cellspacing and cellpadding and border ?