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

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

Development
2
3
1.6k
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.
  • L
    luckman212 LAYER 8
    last edited by Jun 4, 2022, 12:50 PM

    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
    • J
      jimp Rebel Alliance Developer Netgate
      last edited by Jun 6, 2022, 6:12 PM

      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!

      L 1 Reply Last reply Jun 9, 2022, 4:37 AM Reply Quote 0
      • L
        luckman212 LAYER 8 @jimp
        last edited by Jun 9, 2022, 4:37 AM

        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
        2 out of 3
        • First post
          2/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.