Richard,

Neither removing the if/else nor the function_exists() not call worked.

If I declared the function in the same file I called it works even when defining it after the call.

If the function is declaring in a different file than the one I call it in and I include the files after the call, it simply doesn't work. Unless I did something subtly wrong or am back on the drugs.

This SEEMS contrary to the documentation.

The "issue"  occurs in PHP-CLI 4.4.4, PHP 5.2.1, and PHP 5.2.2.

I'll files a bug report in the hope of an explanation but I'm pretty sure that it isn't considered a bug.


Chris




On May 13, 2007, at 1:38 AM, Richard Lynch wrote:

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

Reply via email to