Maybe you could make a separate PHP file, include it there, then pass the results to the main file? On 2/10/07, jekillen <jekillen@xxxxxxxxxxx> wrote:
Hello all; Is there a way to un include a file once it has been included in a script? I have a situation where I need to include a php file for a variable and its value. Then I need to open the file and modify it in the same function 'that included the file. So far the function, as I test it does not appear to be making the intended changes to the file that has been included. And I am not getting any error messages. Am I asking too much: $fileToInclude = 'some_file.php'; function edit_included_file( $fileToInclude) { include($fileToInclude); // use some variable in it $fr = fopen($fileToInclude, 'r'); $str = fread($fr, filesize($fileToInclude)) fclose($fr); // make alterations to $str // reopen file and write the changes // done but in test function I have written changes have not been made } looked through the O'Reilly book Programming Php and could not find a clue. Thanks in advance Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php