Answers for "?? ' ' in php"

PHP
1

$$ in php

$x = "abc";  
$$x = 200;  
echo $x."<br/>";  
echo $$x."<br/>";  
echo $abc; 

// output:
abc
200
200
Posted by: Guest on July-27-2021
-2

?? ' ' in php

// Null Coalesce Operator - $statement ?? ''
$categoryName = $category->name ?? 'Not Available';

// The above Statement is identical to this if/else statement
if (isset($category->name)) {
    $categoryName = $category->name;
} else {
    $categoryName  = 'Not Available';
}
Posted by: Guest on February-16-2021

Browse Popular Code Answers by Language