I'm working my way through a tutorial, Sams Teach Yourself PHP, MySQL, and Apache All in One
at the end of chapter 8, i was going through the "quiz". the second question is where i'm having trouble, but i must show you question #1 to put it in context.
"... 1. What conversion specifier would you use with printf() to format an integer as a double? Indicate the full syntax required to convert the integer 33.
2: How would you pad the conversion you effected in question 1 with zeroes so that the part before the decimal point is four characters long?..." - Sams Teach Yourself PHP, MySQL, and Apache All in One, Ch 8
i knew the asnwer was as follows:
(not sure about the echo "<pre>" being necesary, so i tried it both ways. same result, 'cept the font looked a little different when i used the <pre> tag)
<?php
echo "<pre>";
printf("%04f", 33 );
echo "</pre>";
?>
but, no matter what i try, my result gets no closer to the "correct" answer than 33.00 . i can't get the leading zeros to appear. is it possible that this has something to do w/ my PHP / Apache configuration? everything up to this point has worked fine.
I'm using PHP 4.3.10 on Apache 1.3.33 -- i took that apache number from phpinfo()
is there anything i can do to test my configuration-- so that i know it's working right? i'd hate to really get into something, only to find it doesn't work-- and not be confident about whether it's me, or the configuration causing a problem. i'd probably want to pull my hair out trying to figure it out!