You need to rearchitect your system. When you include a file, its code executes. Once it has been executed, it is done. It will never "rewind" itself. You can open and edit the file, but the code has already executed and that execution has happened, and you cannot change that. What exactly are you trying to accomplish? Dollars to donuts there's a much easier and more logical way than trying to edit an included file. On Saturday 10 February 2007 10:18 pm, jekillen 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 -- Larry Garfield AIM: LOLG42 larry@xxxxxxxxxxxxxxxx ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php