-2
$serial = ($_SERVER['SSL_CLIENT_M_SERIAL'] ?? false);

It looks like a bit like a ternary. But for that I would have expected:

$serial = $_SERVER['SSL_CLIENT_M_SERIAL'] ?  $_SERVER['SSL_CLIENT_M_SERIAL'] : false

perhaps it's shorthand, but finding a link to confirm is difficult. I found the snippet in php4 legacy code.

(note this is php not c#)

Techbot
  • 1
  • 2
  • 1
    _“but finding a link to confirm is difficult”_ - typing “php double question mark” into Google would have lead you to the duplicate in no time … – CBroe May 14 '18 at 13:59
  • thanks, knowing what to search for is half the battle. I was trying '??' instead of 'double question mark – Techbot May 14 '18 at 14:19

2 Answers2

1

I found the snippet in php4 legacy code

That's weird. As far as I know, it was added in PHP 7.

From the docs:

The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand.

Loek
  • 4,037
  • 19
  • 35
-5

its what to do if

    if null

a link ps: you're welcome thanks for the minus 2, loads of languages use this, most notably swift

Mr Heelis
  • 2,370
  • 4
  • 24
  • 34