Answer the question
In order to leave comments, you need to log in
What ?? in php and why is there no information anywhere?
Hello! From David Sklyar's book (page 158) on PHP, I learned about a certain null-join operation. This "miracle" looks like this: print $a ?? "";
The author says that if you do not insert this thing into the code, then if there is nothing in the variable, then an empty string will be used. And then something is wrong, what the hell are we betting after?? this ""? I thought after ?? you can put your own value to be used, but no! The empty string is always used. So that's not all! If you do not use these questions at all, then there will be no error! It will just output an empty string.
These three lines give the same result for any value of $a:
print $a;
print $a ?? "";
print $a ?? "adsad";
Answer the question
In order to leave comments, you need to log in
php.net/manual/en/migration70.new-features.php
Null coalescing operator
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question