html - How to separate Arabic with alphabetical in PHP? -


if try link http://phpfiddle.org/lite/code/ndra-up85 (please submit 1 one) or full code

<style>         .english {             direction: ltr;         }         .arab {             direction: rtl;         } </style>  <?php function bbc2html($content) {     $search = array(         '/(\r\n\r\n|\n\n|\r\r|\n\r\n\r){1,}/',         '/(\r\n){1,}/',         '/(.*?)\001/',         '/(.*?)\002(.*?)/',         '/(\[arab\])(.*?)(\[\/arab\])/',         '/(\[b\])(.*?)(\[\/b\])/',         '/(\[i\])(.*?)(\[\/i\])/',         '/(\[u\])(.*?)(\[\/u\])/',         '/(\[ul\])/',         '/(\[\/ul\])/',         '/(\[ol\])/',         '/(\[\/ol\])/',         '/(\[li\])(.*?)(\[\/li\])/',         '/(\[url=)(.*?)(\])(.*?)(\[\/url\])/',         '/(\[url\])(.*?)(\[\/url\])/'     );     $replace = array(         "\001",         "\002",         '<p class="english">$1</p>',         ' $1',         '<span class="lbs0">$2</span>',         '<strong>$2</strong>',         '<em>$2</em>',         '<u>$2</u>',         '<ul>',         '</ul>',         '<ol>',         '</ol>',         '<li>$2</li>',         '<a href="$2" target="_blank">$4</a>',         '<a href="$2" target="_blank">$2</a>'     );      $oritext = trim($content);     $arrtext = preg_split("/\\n\\n/", $oritext);     $newtext = "";      foreach($arrtext $text) {         $newtext.= trim($text) . "\n\n";     }      $newtext = preg_replace("%([\u{0600}-\u{06ff}]+(?:\s+[\u{0600}-\u{06ff}]+)*)%", ' <b>$1</b>', $newtext);      return preg_replace($search, $replace, $newtext); }  ?>      <form name="form1" method="post" action="">         <p>             <textarea name="mytxtarea" id="mytxtarea" class="ed">this sample textssss  فَإِذَا جَلَسْتَ فِي وَسَطِ الصَّلَاةِ فَاطْمَئِنَّ، وَافْتَرِشْ فَخِذَكَ الْيُسْرَى ثُمَّ تَشَهَّدْ              </textarea>         </p>         <p id="posttextareadisplay"></p>         <p>             <input type="submit" name="submit" value="submit">         </p>     </form> <?php echo html_entity_decode(bbc2html($_post['mytxtarea'])); ?>  <br><br><br><br><br><br>      <form name="form1" method="post" action="">         <p>             <textarea name="mytxtarea2" id="mytxtarea2" class="ed">this sample textssss فَإِذَا جَلَسْتَ فِي وَسَطِ الصَّلَاةِ فَاطْمَئِنَّ، وَافْتَرِشْ فَخِذَكَ الْيُسْرَى ثُمَّ تَشَهَّدْ              </textarea>         </p>         <p id="posttextareadisplay"></p>         <p>             <input type="submit" name="submit" value="submit">         </p>     </form>  <?php echo bbc2html($_post['mytxtarea2']);?> 

later result this

part 1 <p id="posttextareadisplay">     <p class="english">this samplasde textssss</p>     <p class="english"><b>فَإِذَا جَلَسْتَ فِي وَسَطِ الصلَاةِ فَاطْمَئِن، وَافْتَرِشْ فَخِذَكَ الْيُسْرَى ثُم تَشَهدْ</b></p> </p>  part 2 <p id="posttextareadisplay">     <p class="english">this samplasde textssss <b>فَإِذَا جَلَسْتَ فِي وَسَطِ الصلَاةِ فَاطْمَئِن، وَافْتَرِشْ فَخِذَكَ الْيُسْرَى ثُم تَشَهدْ</b></p> </p> 

question part 1 : if see code below, paragraphs or <p> class="english".

how make paragraph or <p> class="english" class="arab", if writing in paragraph arabic? if writing not arabic, paragraph of class="english"

part 1 <p id="posttextareadisplay">     <p class="english">this samplasde textssss</p>     <p class="english"><b>فَإِذَا جَلَسْتَ فِي وَسَطِ الصلَاةِ فَاطْمَئِن، وَافْتَرِشْ فَخِذَكَ الْيُسْرَى ثُم تَشَهدْ</b></p> </p>  *****     want     ******* <p id="posttextareadisplay">     <p class="english">this samplasde textssss</p>     <p class="arab"><b>فَإِذَا جَلَسْتَ فِي وَسَطِ الصلَاةِ فَاطْمَئِن، وَافْتَرِشْ فَخِذَكَ الْيُسْرَى ثُم تَشَهدْ</b></p> </p> 

question part 2 : if arabic joins plain writing or regular fonts. paragraph or <p> remain class="english"

like this

<p class="english"> sa <b>  لْيُسْرَى ثُم تَشَهدْ</b></p> <p class="english"><b>  لْيُسْرَى ثُم تَشَهدْ</b> sa</p> <p class="english"> sa <b> ا لْيُسْرَى ثُم تَشَهدْ</b> sa</p> <p class="english"><b>  لْيُسْرَى ثُم تَشَهدْ</b> sa <b>  لْيُسْرَى ثُم تَشَهدْ</b></p> 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -