note 105553 deleted from function.sprintf by danbrown
| From: | danbrown@php.net | Date: | Mon, 29 Aug 2011 12:42:02 +0000 |
| Subject: | note 105553 deleted from function.sprintf by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182798@lists.php.net to get a copy of this message | ||
Note Submitter: igniz17173 at yahoo dot com
----
Regarding "space" padding specified not properly displayed in html. A Cascaded Style Sheet
property for text, "white-space:pre" can be used to display the white space padding. Known
supported version, HTML 4.0.
<?php
//The 15 monkeys are attacking the [ zoo]!
$format = 'The %d monkeys are attacking the [%10s]!';
echo "<p style=\"white-space:pre\">" . sprintf($format, 15,
'zoo') . "</p>";
?>
Replacing the "space" with HTML escape character " " is still the
safest. Just in case of unsupported CSS.