php - How to remove an include file? -


i have 2 files included in page. this:

// mypage.php include 'script1.php'; include 'script2.php'; 

i need both of them in first, , need remove 1 of them, this:

if ($var == 'one') {       // inactive script1.php file } else {      // inactive script2.php file } 

that's hard explain why need inactive 1 of them, want know, how can that? possible unlike include?

the simple answer no, can't.

the expanded answer when run php, makes 2 passes. first pass compiles php machine code. includes added. second pass execute code first pass. since compilation pass include done, there no way remove @ runtime.

since you're having function collision, here's how around using objects(classes)

class bob {     public static function samename($args) {     } } class fred {    public static function samename($args) {     } } 

note both classes have samename() function live within different class there's no collision. because static can call them so

bob::samename($somearghere); fred::samename($somearghere); 

Comments