Re: Formatting output
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Wed, 14 May 2008 18:03:54 +0200
Patrick wrote:
Jerry Stuckle wrote:Patrick wrote:
fprintf doesn't seem to work for me. It stops things in its tracks and does nothing through the rest of the script beginning at that line.//variable setThat's because fwrite() doesn't accept a formatting string. You write a string; the third parameter is optional and is the number of bytes to write.
$logmonth = $_POST[logmonth];
//and my attempt to format the output
fwrite($out,"%02d\n",$logmonth);
so that it will write to a file
and put a leading 0 in front of single digit months.
Example, for February the output to the file would be 02.
The fwrite doesn't seem to work.
You need fprintf() instead.
//I have it as
fprintf($out,"%02d\n",$logmonth);
Is this right?
The syntax is right if $out is a file resource.
--
//Aho
.
- Follow-Ups:
- Re: Formatting output
- From: Patrick
- Re: Formatting output
- References:
- Formatting output
- From: Patrick
- Re: Formatting output
- From: Jerry Stuckle
- Re: Formatting output
- From: Patrick
- Formatting output
- Prev by Date: Re: Formatting output
- Next by Date: Re: Formatting output
- Previous by thread: Re: Formatting output
- Next by thread: Re: Formatting output
- Index(es):
Relevant Pages
|