• Tobias (unregistered) in reply to TheCPUWizard

    That's not C++. C++ does not have "null" as a value. It's either NULL (old style) or nullptr. So the code snippet is either C# or Java I guess.

  • MrOli (unregistered)

    Depending on the language here, this might be valid.

    In some languages, false == 0 == null == "" == []

    If you want to coerce any "falsy" value to null for sanity, you might do the above.

    But then again, I would do it like this:

    $foo = $foo?$foo:null;

    And probably leave a comment to say as much.

  • mbfkjq' (unregistered) in reply to bjolling

    My first thought as well.

Leave a comment on “As The World Ternaries”

Log In or post as a guest

Replying to comment #:

« Return to Article