Re: Function redefine ?

From: Date: Sun, 07 Jan 2001 19:28:45 +0000
Subject: Re: Function redefine ?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-33108@lists.php.net to get a copy of this message
As long as nothing in file1.inc is referenced in file2.inc you could also just make sure you include file2 first. At 08:23 PM 1/7/2001 +0100, Alexander Wagner wrote:
Abe wrote: Does that mean PHP3 users are bound to use just one include file? No, they are bound to be careful about what they include. The solution to your problem is to rearrange your files. The files are executed top down, so a function is defined only for the following lines, not for the lines before (at least in php3, I'm not sure about 4). This is not checked during parse-time, but at execution time. So you never run into trouble if your files look like this: <?php function f1() { } function f2() { } .. .. .. f1(); ?> The real execution (not the parsing) of the functions begins with the first funtion call, so if you put it on the last line (or at least below all the function definitions), this should fix your problem. If the include-files contain function calls, the calls in the first include-file may require something from file2, which will break you code sind file2 isn't included yet. Move these calls to menu.php3, the end of it, if possible, include all files at the beginning of menu.php3, and it should work. regards Wagner -- Sanity is calming, but madness is more interesting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#33108) next »