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, 2022 in PHP by Kithuzzz
• 38,000 points
732 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,840 points
7,579 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, 2022 in PHP by Kichu
• 19,040 points
521 views
0 votes
0 answers

PHP | define() vs. const

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

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

PHP "php://input" vs $_POST

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

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

How to write a PHP ternary operator

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

Jun 14, 2022 in PHP by narikkadan
• 63,600 points
353 views
0 votes
0 answers

getenv() vs. $_ENV in PHP

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

Aug 8, 2022 in PHP by narikkadan
• 63,600 points
1,559 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, 2022 in PHP by Kithuzzz
• 38,000 points
644 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
1,567 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
11,409 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,670 points
4,456 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP