Related questions
What does double question mark (??) operator mean in PHP
I was diving into Symfony framework (version 4) code and found this piece of code:
$env = $_SERVER['APP_ENV'] ?? 'dev';
I'm not sure what this actually does but I imagine that it expands to something like:
$env = $_SERVER['APP_ENV'] != null ? $_…
php string number concatenation messed up
I got some php code here:
<?php
echo 'hello ' . 1 + 2 . '34';
?>
which outputs 234,
but when I add a number 11 before "hello":
<?php
echo '11hello ' . 1 + 2 . '34';
?>
It outputs 1334 rather than 245(which I expected …
ternary operator in php with echo value
I want to write the following code in ternary operator. I tried in many way but it does not work at all.
<?php
if(isset($options['footer_txt_color'])) {
echo $options['footer_txt_color'];
} else {
echo "#ffffff";
}
?>