/    Sign up×
Community /Pin to ProfileBookmark

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:

[CODE]<?php
print(function_exists(“function_exists”));
?>[/CODE]

the output would be:

1

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

with this code:

[CODE]<?php
print(function_exists(“print”));
?>[/CODE]

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

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 04.2007 — Because "print" is a PHP language construct, not a function.
×

Success!

Help @mainstream spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...