Test Ar-PHP Functionality Online

header line!
Test PHP Function













Ar-PHP Manual

static method highlightText [line 323]

static string highlightText( string $str, [string $style = null])

Highlighted all nouns in a given Arabic string



Tags:

return:  Arabic string in HTML format where all nouns highlighted
author:  Khaled Al-Sham'aa <khaled@ar-php.org>
access:  public


Parameters:

string   $str   Arabic string you want to highlighted all its nouns
string   $style   Name of the CSS class you would like to apply

Example
  1.      include('./I18N/Arabic.php');
  2.      $obj new I18N_Arabic('WordTag');
  3.  
  4.      $hStr=$obj->highlightText($str,'#80B020');
  5.  
  6.      echo $str '<hr />' $hStr '<hr />';
  7.  
  8.      $taggedText $obj->tagText($str);
  9.  
  10.      foreach($taggedText as $wordTag{
  11.          list($word$tag$wordTag;
  12.  
  13.          if ($tag == 1{
  14.              echo "<font color=#DBEC21>$word is Noun</font>, ";
  15.          }
  16.  
  17.          if ($tag == 0{
  18.              echo "$word is not Noun, ";
  19.          }
  20.      }
Popular
Recent
Links
Ads!
footer line!

No Software Patents! General Public License

Home | Twitter | Blog | Contact

Copyright © 2006 - 2016 Khaled Al-Sham'aa