Better Truncator

<?php

$longString ="http://google-maps.pace.com?var=ntahohk5eoui564x56oe4u564oa5oeu5aoeu5ao5u5eu56io14eui564oe";
$separator = '/.../';
$separatorlength = strlen($separator) ;
$maxlength = 25 - $separatorlength;
$start = $maxlength / 2 ;//Change to max length to truncate end
$trunc = strlen($longString) - $maxlength;

echo substr_replace($longString, $separator, $start, $trunc);

?>

Shorten string words

function limit_string_words($string,$word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words);
}

Divide a string

$string_to_divide = "This is the part of the string to keep: This is the part to be removed";
$dividing_character = ':';
$pos = strpos($string_to_divide, $dividing_character);
$divided_string = substr_replace($string_to_divide, "", $pos);

echo "Divided String = $divided_string";