OZONE Asylum
Forums
Server-Side Scripting - Oh my!
FWRITE - Why does "skip a line" influences subsequent writes?
This page's ID:
31458
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
My code below writes the first line, intermediate lines, and finally the last line. NOTE: I want to skip a line after writing the first, and only the first, line. But - putting the "\n" after the first write causes ALL subsequent writes to ALSO skip a line - something I do not want to happen, even though those fwrites do NOT have the "\n" in their syntax. Why does the first write's skip action influence the rest of the fwrites, and how, then, do I get only the first skip executed without causing further skips thereafter? <?php $file = fopen("./readArray.php","r"); $wfile = fopen("./writeArray.txt", "w"); fwrite($wfile, "var jsArray = [\n"); while(! feof($file)) { $phpLine = fgets($file); fwrite($wfile, $phpLine); } fclose($file); fwrite($wfile, "]"); fclose($wfile); ?> If I change the first fwrite statement to fwrite($wfile, "var jsArray = ["); each write appears on their own line, as I want it, except for the first line's missing skip. How do I skip only after the first fwrite?
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail