Close an included file?

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
HiddenS3crets
Forum Contributor
Posts: 119
Joined: Fri Apr 22, 2005 12:23 pm
Location: USA

Close an included file?

Post by HiddenS3crets »

Is there a way to close an included file when it is not needed anymore?

Ex:

Code: Select all

<?php
// Include file
include("/file.inc");

// Create new object
$current = new file;

// Perform a function
$current->someFunction();

// After this, file.inc is not needed anymore.
// Can it be closed so it cannot be accessed again (unless it is included again somewhere further down of course)
?>
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

You are not opening the file per-say. you are including it, therefore no you can't open and close it.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

With PHP, all files and other connections are closed, and all memory freed when the script ends.
(#10850)
Post Reply