Page 1 of 1

Using require_once then require

Posted: Wed Nov 11, 2009 1:59 am
by mediatagging
I have two files A & B.

All the files are linked. In file A, I have require_once(filename.php). In file B i have require(filename.php). For some reason this causes some conflict when running the code. There is code in File A that usually runs, but doesnt when the above is the case. Any idea why? Thanks.

Re: Using require_once then require

Posted: Wed Nov 11, 2009 2:14 am
by requinix
And what's in filename.php?

Re: Using require_once then require

Posted: Wed Nov 11, 2009 9:59 am
by mediatagging
Filename.php just has a function. A blank function that doesn't get called. It definitely has something to do with the requires because once I commented out the first one everythig worked fine.

Re: Using require_once then require

Posted: Wed Nov 11, 2009 2:55 pm
by requinix
Can't define a function twice. One file included filename.php, then another. That second time caused PHP to halt.

Use require_once.