title: How to align some text as right aligned in textarea?
body: <p>I have some text(which contains some Arabic also) saved in DB. I am fetching the data and displaying them in the textarea.</p>
  
  <p><a href="https://i.stack.imgur.com/RalEp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RalEp.png" alt="enter image description here"></a></p>
  
  <p><strong>I want the English text to be aligned left, and the arabic text to be aligned right.</strong></p>
  
  <p>For this, I have split the whole text into paragraphs and detect which paragraph should be right aligned and which one should be left aligned.</p>
  
  <p>Here's the code.</p>
  
  <pre><code>/*------ Allign text ------*/
  function align_text($text)
  {
      $string = $text;
      $returnString = '';
      $paraArray = explode("\n", $string);
      if(count($paraArray) &gt; 0)
      {
          foreach($paraArray as $pa)
          {
              $isRight = $this-&gt;is_rtl($pa);
              if($isRight)
              {
                  $para['para'] = $pa;
                  $para['align'] = 'R';
              }
              else
              {
                  $para['para'] = $pa;
                  $para['align'] = 'L';
              }
              $paraArr[] = $para;
          }
      }
      else
      {
  
      }
      return $paraArr;
  }
  
  function is_rtl($string) 
  {
      $rtl_chars_pattern = '/[\x{0590}-\x{05ff}\x{0600}-\x{06ff}]/u';
      return preg_match($rtl_chars_pattern, $string);
  }
  </code></pre>
  
  <p>So, as you can see, each paragraph can be arranged as per Right-aligned and Left-aligned when displaying in webpage(html) using div.</p>
  
  <pre><code>&lt;?php
  foreach($paraArr as $row)
  {
     if($row['align'] == 'L')
     {?&gt;
      &lt;div class="left-align"&gt;&lt;?php echo $row['para'];?&gt;&lt;/div&gt;
     &lt;?php
     }
     else
     {?&gt;
     &lt;div class="left-align"&gt;&lt;?php echo $row['para'];?&gt;&lt;/div&gt;
    &lt;?php }
  }?&gt;
  </code></pre>
  
  <p>But my main question is, <strong>How can I align the Arabic paragraph as right aligned inside SAME textarea?</strong>.</p>