Na ktorej verzii funguje null coalescing operátor v php

Príklady kódu

1
0

php null coalesce

// if $_POST['name'] doesn't exist $result will equal to John
$result = $_POST['name'] ?? 'John';
1
0

null Koalescenčný operátor php

// The null coalescing operator (??) is used to replace the ternary operation
// in conjunction with isset() function and returns its first operand if it
// exists and is NOT NULL; otherwise it returns its second operand.
$username = $_GET['username'] ?? 'not passed';

// Equivalent code using ternary operator
$username = isset($_GET['username']) ? $_GET['username'] : 'not passed';

V iných jazykoch

Táto stránka je v iných jazykoch

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................