私の関数にはある程度の長さがありますが、使用するのが好きです。文字列 int を配列に変換します。
function truncate($text, $limit){
    //Set Up
    $array = [];
    $count = -1;
    //Turning String into an Array
    $split_text = explode(" ", $text);
    //Loop for the length of words you want
    while($count < $limit - 1){
      $count++;
      $array[] = $split_text[$count];
    }
    //Converting Array back into a String
    $text = implode(" ", $array);
    return $text." ...";
  }
または、テキストがエディターからのもので、HTML タグを削除したい場合。
function truncate($text, $limit){
    //Set Up
    $array = [];
    $count = -1;
    $text = filter_var($text, FILTER_SANITIZE_STRING);
    //Turning String into an Array
    $split_text = preg_split('/\s+/', $text);
    //Loop for the length of words you want
    while($count < $limit){
      $count++;
      $array[] = $split_text[$count];
    }
    //Converting Array back into a String
    $text = implode(" ", $array);
    return $text." ...";
  }