Is it possable to un-include a file to reduce the footprint of a script?
That is, after it is included, can it be un-included?

Recommended Answers

All 6 Replies

why?!?!? reduce the footprint? what does that mean.

I anything I have coded, I have never needed to do this, I can't even think of a reason to.

btw, I don't think its possible

I don't think it's possible.

Once the file is parsed then it's parsed so there would be no point.

I don't know what you mean by a footprint....

@kkeith29: Just because you can't think of a reason, that does not mean, that there cannot be a reason for this.

Right now i have 2 Joomla-Installations: cms-dev and cms-prod are the two folders. Now i want to copy cms-prod to cmd-dev, but before that i need to copy the database.
So i include cms-prod/configuration.php and setup $config-live = new JConfig(), to be able to access the config-values for db-host etc.
Now i want to include the cms-dev configuration, to write the dumped mysql-data into the dev-table. But here php says: "Fatal error: Cannot redeclare class JConfig in cms-dev/configuration.php on line x".

The first thing i thought about was un-including the first configuration-file.. but i guess this is not possible and i have to create another workaround.

This was just an example. There can be many others, why one could want to un-include something :-p

why not just include_once() ? or am i missing the big picture?

Member Avatar for diafol

@robbz

Did you really mean to resurrect this dead post? Let sleeping dogs lie.

Yes i really meant it :-p
I pointed out in what situations one could need something like an un-include.

This Post is still in the Google-index. So it can be found. why not provide other users searching for something like this with these informations? I did not want to open another Topic for that ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.