PHP Elvis operator vs null coalescing operator

0 votes

Can someone clarify the differences between PHP's null coalescing operator (??) and ternary operator abbreviation (?:)?

When do they act differently from when they act similarly, if at all?

$a ?: $b

Vs.

$a ?? $b

Can someone please explain this to me?

Aug 3 in PHP by Kithuzzz
• 4,080 points
5 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

What does double question mark (??) operator mean in PHP?

Hello, It's the "null coalescing operator", added in ...READ MORE

answered Apr 2, 2020 in PHP by Niroj
• 82,740 points
4,791 views
0 votes
0 answers

php var_dump() vs print_r()

What is the difference between var_dump() and print_r() in terms of ...READ MORE

May 28 in PHP by Kichu
• 19,040 points
23 views
0 votes
0 answers

PHP | define() vs. const

In PHP, there are two ways to ...READ MORE

Jun 1 in PHP by Kichu
• 19,040 points
40 views
0 votes
0 answers

PHP "php://input" vs $_POST

I want to know what is the ...READ MORE

Jun 9 in PHP by Kichu
• 19,040 points
34 views
0 votes
0 answers

How to write a PHP ternary operator

How can I write a PHP ternary operator ...READ MORE

Jun 14 in PHP by narikkadan
• 11,280 points
9 views
0 votes
0 answers

getenv() vs. $_ENV in PHP

What is the distinction between $_ENV and ...READ MORE

6 days ago in PHP by narikkadan
• 11,280 points
14 views
0 votes
0 answers

Switch php versions on commandline ubuntu 16.04

On my Ubuntu 16.04, I've installed PHP ...READ MORE

Jul 30 in PHP by Kithuzzz
• 4,080 points
8 views
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
543 views
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
9,290 views
0 votes
1 answer

Failure uploading Image on AmazonS3 with PHP SDK

Try this, I took it out from ...READ MORE

answered May 4, 2018 in AWS by Cloud gunner
• 4,660 points
2,217 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP