fwrite to middle of file (Maybe or an alternative?)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

fwrite to middle of file (Maybe or an alternative?)

Post by Chris Corbyn »

Hi,

I need to fwrite() to a file but keep everything that's written sandwiched between php tags.

I'm guessing it can't be difficult to do.

There may be another way to do what i want anyway. The stuff I'm writing is the elements of an array which I will do things with by including it with include() in another script. So can I somehow just have the page that's written to without php tags and let the other page read it as php anyway?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why not just include a basic text file between the php tags? Then just include this file:

Code: Select all

<?php include('your_text_file_here.txt'); ?>
afaik, it'd work just fine. :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Excellent cheers!

Don't know why I never considered that one myself :-/

It does work yeah
Post Reply