note 48839 added to function.strlen
| From: | webmaster at elcurriculum dot com | Date: | Sat, 08 Jan 2005 19:49:45 +0000 |
| Subject: | note 48839 added to function.strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82959@lists.php.net to get a copy of this message | ||
This function is for cut the long text.
//Recortar texto si es mayor de $Car caracteres...
function GetRecortarTexto ($vTxt, $Car) {
if (strlen($vTxt) > $Car) {
return substr($vTxt, 0, $Car) . "...";
} else return $vTxt;
}
//Example
$frase = "This is a long text";
$char = 10; //Max long...
echo GetRecortarTexto($frase, $char);
Return:
This is a ...
More:
http://php.elcurriculum.com
http://tryke.elcurriculum.com
----
Manual Page -- http://www.php.net/manual/en/function.strlen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48839
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48839&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48839&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48839&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48839&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48839&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48839&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48839&report=yes
Search -- http://master.php.net/manage/user-notes.php