Apply for Zend Framework Certification Training

Corephp




implode(' ', array_slice(explode(' ', $sentence), 0, 10));

To add support for other word breaks like commas and dashes,
preg_match gives a quick way and doesn't require splitting the string:

function get_words($sentence, $count = 10) {
  preg_match("/(?:w+(?:W+|$)){0,$count}/", $sentence, $matches);
  return $matches[0];
}                                    

< Send all values of form using jquery How to select option attribute value using jquery >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top