note 46919 deleted from ref.strings by derick

From: Date: Wed, 09 Feb 2005 18:11:03 +0000
Subject: note 46919 deleted from ref.strings by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-84739@lists.php.net to get a copy of this message
Note Submitter: [tab!] ---- // // string strtrmvistl(string str, [int maxlen = 64]) // // like strtrmvistl(). returns only the start and end chunk // in an array for further processing. // function strtrmvistl_a($str, $maxlen = 64) { $res = array('start' => $str, 'end' => 0); if(($len = strlen($str = chop($str))) > ($maxlen = max($maxlen, 12))) { $res['start'] = substr($str, 0, $maxlen - 3); if($len > ($maxlen - 3)) { $endlen = min(($len - strlen($res['start'])), $maxlen - 3); $res['start'] .= "..."; $res['end'] = "..." . substr($str, $len - $endlen); } } return($res); }

« previous php.notes (#84739) next »