View Single Post
Old 12-30-2007, 09:43 AM   #9 (permalink)
xenon
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

The problem is quite simple. If you need to get the contents of a file unaltered, read the file contents and parse it. If you need to perform php operations in a file and just capture the result, use include/require (and they're _once forms).

Now, for the handles. Think of a handle as a door and the variable that references the handle as the key to the door. You need the key every time you use the door. Check out the analogy with the actual code:

PHP Code:
// get the 'door key'
$fh fopen('filename.txt.''rb');
// you need to use the key every time you do an operation that involves using 'the door'
// read the file, line by line
while( $line fgets$fh1024 ) )
{
echo 
$line;
}
// lock the 'door' & destroy the 'key' when you're done
fclose$fh ); 
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote