Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    use of $x <> $y vs. $x != $y

    Scheduled Pinned Locked Moved Development
    3 Posts 2 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • luckman212L
      luckman212 LAYER 8
      last edited by

      Just curious, I see both forms of comparison operators used throughout the code. grep -c tells me that != is preferred by a wide margin. Yet I still see the other form used, even recently e.g. this commit.

      != definitely seems more correct to me, and has the additional form !== to enforce type matching. I was wondering if there was a reason not to convert the remaining <>s and put a note in the style guide under the php-specific section ?

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        It's one of those things that is functionally equivalent and we haven't strictly standardized. Usually when a new commit adds it it's along side or near a place that used it in the past.

        We probably should move them all to != but it's not high on anyone's priority list.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        luckman212L 1 Reply Last reply Reply Quote 0
        • luckman212L
          luckman212 LAYER 8 @jimp
          last edited by

          Ok, if nobody else wants to do it I'm happy to rip through them and get them all consistent.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.