Zend Certification PHP 5 : Difference between isset() and other is_*() functions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • oggy

    #1

    Zend Certification PHP 5 : Difference between isset() and other is_*() functions

    Hello
    I try to answer this question for the Zend Certification PHP 5 :
    "What is the difference between isset() and other is_*() functions
    (is_alpha(), is_number(), etc.)?"

    Do you have a solution ?

    Thanks

  • ZeldorBlat

    #2
    Re: Zend Certification PHP 5 : Difference between isset() and other is_*() functions


    oggy wrote:
    Hello
    I try to answer this question for the Zend Certification PHP 5 :
    "What is the difference between isset() and other is_*() functions
    (is_alpha(), is_number(), etc.)?"
    >
    Do you have a solution ?
    >
    Thanks
    Read this:
    <http://www.php.net/isset>

    In particular the warning that "isset() only works with variables as
    passing anything else will result in a parse error" and the note that
    "Because this is a language construct and not a function, it cannot be
    called using variable functions."

    Comment

    • oggy

      #3
      Re: Zend Certification PHP 5 : Difference between isset() and other is_*() functions

      thanks a lot
      "isset() only works with variables" means that its not working with
      constants (only).

      On 27 déc, 20:21, "ZeldorBlat " <zeldorb...@gma il.comwrote:
      oggy wrote:
      Hello
      I try to answer this question for the Zend Certification PHP 5 :
      "What is the difference between isset() and other is_*() functions
      (is_alpha(), is_number(), etc.)?"
      >
      Do you have a solution ?
      >
      ThanksRead this:
      <http://www.php.net/isset>
      >
      In particular the warning that "isset() only works with variables as
      passing anything else will result in a parse error" and the note that
      "Because this is a language construct and not a function, it cannot be
      called using variable functions."

      Comment

      • ZeldorBlat

        #4
        Re: Zend Certification PHP 5 : Difference between isset() and other is_*() functions


        oggy wrote:
        thanks a lot
        "isset() only works with variables" means that its not working with
        constants (only).
        >
        That's half of it. The other half is that it won't work with the
        return value of a function call (directly). Consider the following:

        function foo() {
        return 1;
        }

        //This is ok:
        $x = foo();
        isset($x);

        //But this throws a fatal error:
        isset(foo());

        Comment

        Working...