Excerpt custom function – character length

This code will limit the excerpt to the desired number of character, without truncating the last word. The function –

function get_excerpt($count){
  $permalink = get_permalink($post->ID);
  $excerpt = get_the_content();
  $excerpt = strip_tags($excerpt);
  $excerpt = substr($excerpt, 0, $count);
  $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
  $excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>';
  return $excerpt;
}

Echoing the excerpt

<?php echo get_excerpt(125); ?>