note 22881 added to function.sprintf

From: Date: Wed, 03 Jul 2002 06:22:14 +0000
Subject: note 22881 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-32535@lists.php.net to get a copy of this message
An error in my last example: $b = sprintf("%30.s", $a); will only add enough spaces before $a to pad the spaces + strlen($a) to 30 places. My method of centering fixed text in a 72 character width space is: $a = "Some string here"; $lwidth = 36; // 72/2 $b = sprintf("%".($lwidth + round(strlen($a)/2)).".s", $a); -- http://www.php.net/manual/en/function.sprintf.php http://master.php.net/manage/user-notes.php?action=edit+22881 http://master.php.net/manage/user-notes.php?action=delete+22881 http://master.php.net/manage/user-notes.php?action=reject+22881

« previous php.notes (#32535) next »