note 23369 added to function.sprintf
| From: | php-general at lists dot php dot net | Date: | Tue, 16 Jul 2002 19:15:42 +0000 |
| Subject: | note 23369 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33179@lists.php.net to get a copy of this message | ||
You can't use sprintf() to put items in an array, at least not directly.
$myarr = array(sprintf("%-40s", $somevar));
ought to put $somevar left-justified in 40 spaces, into the array. Instead you get a parse error:
unexpected T_ENCAPSED_AND_WHITESPACE. Apparently the 's' in sprintf doesn't actually
stand for 'string,' because that's not what sprintf is returning here. Too bad.
--
http://www.php.net/manual/en/function.sprintf.php
http://master.php.net/manage/user-notes.php?action=edit+23369
http://master.php.net/manage/user-notes.php?action=delete+23369
http://master.php.net/manage/user-notes.php?action=reject+23369