www.webdeveloper.com
Results 1 to 2 of 2

Thread: Ligth Talk

  1. #1
    Join Date
    Aug 2007
    Posts
    14

    Ligth Talk

    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"));
    ?>
    the output would be:

    1

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

    with this code:

    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
    Last edited by mainstream; 09-04-2007 at 04:17 AM.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Because "print" is a PHP language construct, not a function.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles