I want to write a formatted string that will process to a specific output stream like a file. What function is good for this?

A1WEBSITEPRO QuestionsCategory: PHPI want to write a formatted string that will process to a specific output stream like a file. What function is good for this?
B. Smith asked 1 year ago

I want to write a formatted string that will process to a specific output stream like a file. What function is good for this?

I want to write a formatted string that will process to a specific output stream like a file. What function is good for this? was last modified: March 23rd, 2023 by B. Smith
1 Answers
Best Answer
Maximus Mccullough Staff answered 5 years ago

You can use the printf() function. Here is an example. 
[php]&lt;?php<br />$var = 3;<br />$string = "Puppies";<br />$thefile = fopen("foo.txt","w");<br />echo fprintf($thefile,"I have %u very cute %s.",$number,$str);<br />?&gt;[/php]

Answer for I want to write a formatted string that will process to a specific output stream like a file. What function is good for this? was last modified: December 13th, 2018 by Maximus Mccullough