Advertisement
SergeyBiryukov

Untitled

Sep 13th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. $excerpts = array(
  2.     "Hello world: This.is, your first post... Edit or delete it, then start blogging!",
  3.     "Hello world: This.is, your first post… Edit or delete it, then start blogging!",
  4. );
  5.  
  6. foreach ( $excerpts as $excerpt ) {
  7.     preg_match( '#(.*?)([.!?]|…)(\s|$)#', $excerpt, $matches );
  8.     if ( $matches )
  9.         $excerpt = $matches[0];
  10.     echo $excerpt . '<br />';
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement