Page 1 of 1

(un)require file

Posted: Thu Jun 19, 2003 3:35 am
by nre
I have 3 files:

//---file1.php----
function func1() {
echo "1";
}

//---file2.php----
function func1() { //the func name is the same like func name in file1.php
echo "2";
}

//---file3.php----
require "file1.php";
func1(); //it will write '1'

now I want to require "file2.php" and when the code again reaches to the func1(), it have to write '2'

so is there any unrequire function to remove file1.php include?
or some method for dynamic function deleting?

thx.

Posted: Thu Jun 19, 2003 3:45 am
by delorian
Some function overloading, ha :?: I don't think you can do that in PHP4, and the same with unrequire. Can you just write one function which will distinguish by func_get_args() or func_num_args() what version to use :?: