SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please explain the difference between != and !==

    Hello!

    This one comes directly from php.net so don't tell me it is incorrect syntax.
    http://www.php.net/manual/en/function.readdir.php

    What does false !== exactly mean?
    What is the difference between !== and != ?
    I know = is used to set something, and with == i ask for the equivalent, but i still don't get it.

    Thanks a lot in advance!

    Best regards from Vienna,
    Jürgen

  2. #2
    Shiver me timbers!! anthony_irl's Avatar
    Join Date
    Aug 1999
    Location
    Dublin, Ireland
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    != will check for equality
    !== will check for equality as well as type

    For a full explanation check this page in the manual.
    Last edited by anthony_irl; Apr 8, 2002 at 09:00.
    Anthony - How's tings?

    24 hours in a day, 24 beers in a case. Coincidence? I think not.
    Contact me by: PM ¦ Email ¦ NEW! Carrier Pigeon

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2002
    Location
    Launceston, Australia
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From what I can see in the manual, using !== ensures the following:

    TRUE if $a is not equal to $b, or they are not of the same type;

    whereas, using != just tests if $a is not equal to $b.

    The key is that !== is checking to see if they are not of the same type as well ie while the statement ($file = readdir($handle)) evaluates to false, the whole statement is evaluating to TRUE, since it is true that false !== true (if you get what I mean!).

  4. #4
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    look here... 5th entry in the table...

    'identical' means the variable is of the same type and value

    <<edit>> ok so i'm the slowest and i even typed the least!!

  5. #5
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you


Bookmarks

Posting Permissions

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