title: Jquery and PHP function
body: <p>How can I this PHP function include in jquery .html?</p>
  
  <p>PHP function:</p>
  
  <pre><code>function trim_text($string, $limit, $break="&lt;", $pad=" ...")
  {
  $words = explode(' ', htmlentities(strip_tags($string)));
  $countr = count($words);
  if ($countr &lt;= 8)
  {
  return $string;
  }else{
  
  
  // return with no change if string is shorter than $limit
  if(strlen($string) &lt;= $limit) return $string;
  $string = substr($string, 0, $limit);
  if(false !== ($breakpoint = strpos($string, $break, $limit))) {
  if($breakpoint &lt; strlen($string) - 1) {
  
    $string = substr($string, 0, $breakpoint) . $pad;
  }
  }
  $last_space = strrpos(substr($string, 0, $limit), ' ');
  $string = substr($string, 0, $last_space);
  $string = strip_tags($string);  
  return $string.$pad;
  }
  }
  </code></pre>
  
  <p>And the Jquery part of code where I want to in ".html" part somehow call this function is:</p>
  
  <pre><code>$(" .text").html('&lt;div&gt;'+ message +'&lt;/div&gt;');
  </code></pre>
  
  <p>What I want to do is trim this "message" text using PHP function. Is it possible?</p>