Skip to content

Instantly share code, notes, and snippets.

@opengeek
Created September 26, 2010 15:27
Show Gist options
  • Save opengeek/598021 to your computer and use it in GitHub Desktop.
Save opengeek/598021 to your computer and use it in GitHub Desktop.
<?php
$output = $input;
$limit = intval($options) ? intval($options) : 100;
if (function_exists('mb_strlen')) {
if (mb_strlen($output, $encoding) > $limit) {
$output = mb_substr($output, 0, $limit, $encoding) . '&hellip;';
}
} else if (strlen($output) > $limit) {
$output = substr($output, 0, $limit) . '&hellip;';
}
return $output;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment