note 92474 deleted from function.substr by googleguy

From: Date: Tue, 16 Oct 2012 11:55:44 +0000
Subject: note 92474 deleted from function.substr by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191324@lists.php.net to get a copy of this message
Note Submitter: gkhelloworld at gmail dot com ---- 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

« previous php.notes (#191324) next »