Click to See Complete Forum and Search --> : Ligth Talk


mainstream
09-04-2007, 04:13 AM
hi... im a newbie... using function_exists() is very very useful...

is it true that print() is a function? if yes, then proceed to this...

with this code:

<?php
print(function_exists("function_exists"));
?>

the output would be:

1

any function test works fine with it except for print()...

with this code:

<?php
print(function_exists("print"));
?>

the result is empty... i know that it is useless testing print()... but is it really the exact explanation behind why print() does not work with function_exists() (that it is useless)?

if it so, then why function_exists() works when function_exists itself is used as a parameter (see the first example)? well, function_exists is also useless because in the first place you cannot invoke it if it does not exist right?

i just couldn't see which is which...

1) when using function_exists as a parameter works fine is reasonable, then print should work fine too, because it is also a function. otherwise, this is a lack of codes within the function_exists().

2) on the other hand, when using print as a paramater doesn't work is reasonable, then function_exists shouldn't work too, because it is useless testing if a function exists when itself is used as a parameter. otherwise, this is a waste of codes within the function_exists().

Note:
- i am using PHP v5.2.3
- this is not a question of the usage of the function but the integrity of the function

NogDog
09-04-2007, 06:08 AM
Because "print" is a PHP language construct, not a function.