note 77491 added to function.substr

From: Date: Fri, 31 Aug 2007 14:51:47 +0000
Subject: note 77491 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-129944@lists.php.net to get a copy of this message
I wanted to shorten long words and add '...' so it would turn : 'thisisareallylongnamedfile.jpg' and it shall appear like 'thisisareally...' function short_name($str) { $limit = 35; if(strlen($str > $limit)) { # # If the name is greater than 35 characters # then only display 35 charatcers followed # by ... # return substr($str, 0, $limit) . " ..."; } else { # # Too small; so no need to change # return $str; } } ---- Server IP: 194.145.210.3 Probable Submitter: 217.36.72.165 ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- https://master.php.net/note/edit/77491 Del: integrated -- https://master.php.net/note/delete/77491/integrated Del: useless -- https://master.php.net/note/delete/77491/useless Del: bad code -- https://master.php.net/note/delete/77491/bad+code Del: spam -- https://master.php.net/note/delete/77491/spam Del: non-english -- https://master.php.net/note/delete/77491/non-english Del: in docs -- https://master.php.net/note/delete/77491/in+docs Del: other reasons-- https://master.php.net/note/delete/77491 Reject -- https://master.php.net/note/reject/77491 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129944) next »