note 92474 added to function.substr
| From: | gkhelloworld at gmail dot com | Date: | Sun, 26 Jul 2009 10:40:14 +0000 |
| Subject: | note 92474 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158733@lists.php.net to get a copy of this message | ||
Shortens the filename and its expansion has seen.
$file = "Hellothisfilehasmorethan30charactersandthisfayl.exe";
function funclongwords($file)
{
if (strlen($file) > 30)
{
$vartypesf = strrchr($file,".");
$vartypesf_len = strlen($vartypesf);
$word_l_w = substr($file,0,15);
$word_r_w = substr($file,-15);
$word_r_a = substr($word_r_w,0,-$vartypesf_len);
return $word_l_w."...".$word_r_a.$vartypesf;
}
else
return $file;
}
// RETURN: Hellothisfileha...andthisfayl.exe
// other simples on rollyz.net
----
Server IP: 78.41.104.8
Probable Submitter: 91.124.234.159
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/92474
Del: integrated -- https://master.php.net/note/delete/92474/integrated
Del: useless -- https://master.php.net/note/delete/92474/useless
Del: bad code -- https://master.php.net/note/delete/92474/bad+code
Del: spam -- https://master.php.net/note/delete/92474/spam
Del: non-english -- https://master.php.net/note/delete/92474/non-english
Del: in docs -- https://master.php.net/note/delete/92474/in+docs
Del: other reasons-- https://master.php.net/note/delete/92474
Reject -- https://master.php.net/note/reject/92474
Search -- https://master.php.net/manage/user-notes.php