Re: Function Declared in Included File Not Being Found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 11, 2007 3:43 pm, Chris wrote:
> Hello,
>
> According to the PHP manual on functions (http://www.php.net/manual/
> en/language.functions.php):
>
> "In PHP 3, functions must be defined before they are referenced. No
> such requirement exists since PHP 4. Except when a function is
> conditionally defined..."

Does moving the require BEFORE the if/else change anything?

> If that is true then why does the following not work as I expect?

Not sure, really...

Seems like you're right, but maybe I'm also missing something.

If you take out the 'require' statements, and just put c inside a,
does it work?

> I expect the result to be "Function was called!" but it actually is
> "Function test() does not exist!".

Perhaps the if (function_exists()) business is trying to be "smart"
and is run because at the time it was compiled, the function didn't
exist, so you could define the function there -- which is a much more
common idiom than what you are doing, truth to tell...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux