note 54456 deleted from function.str-repeat by tomsommer

From: Date: Fri, 03 Mar 2006 10:42:08 +0000
Subject: note 54456 deleted from function.str-repeat by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-104763@lists.php.net to get a copy of this message
Note Submitter: pawan at shopsbs dot com ---- Thanks for the code Gal Chen I was having trouble using the str_pad function to pad my text (I could never find a reason why). Your code just worked just fine. I just fine tuned it to add a piece of sting (default is a <space>) Code: function str_repeattolength ($str, $length, $end = "&nbsp;") { $strlength= strlen($str); if ($strlength>= $length) { return substr($str,0,$length) . $end; } else { return $str . str_repeattolength($str, $length - $strlength) . $end; } }

« previous php.notes (#104763) next »