Selection Sort in PHP With Example | How does selection sort work in PHP ?
PHP Form validation | Validate User Input Data In PHP In Hindi
PHP Interview Questions In Hindi : PHP Interview Preparation
PHP null In Hindi | PHP is null Function
PHP filter_var() Function In Hindi | filter_var() In PHP In Hindi
Snowflake Virtual warehouses In Hindi | Create warehouse In Snowflake In Hindi
what is CIDR (Classless Inter-Domain Routing or supernetting) In Hindi / CIDR kya hai
JavaScript console Object : Window Console Object In Hindi
wc Command In Linux | Linux count characters in line or file
If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
Image on pixabay
PHP में Null Coalescing Operator सिर्फ ternary operator की जगह use किया जाने वाला operator था। जिसका main purpose isset() और ternary operator को replace की तरह use में लिया गया। इस Operator को PHP version 7
में introduce किया था।
Null coalescing operator , दो operands के साथ work करता है अगर first operand की value null
, empty और undefined
नहीं हुआ तो first operand return करेगा otherwise second operand return होगा।
<?php
// here $var is not defined.
echo $var ?? "Variable not defined";
?>
इसी तरह से अगर variable की value null
या 0 हुई तो second operand return होगा।
<?php
$var = null;
echo $var ?? "null Variable";
echo "<br/>"; // line break.
// now put some value.
$var = "Hello ! learners.";
echo $var ?? "null Variable";
?>
Null coalescing operator काफी easy to use है और ternary या if-else के comparison में काफी short भी है। इसे आप one line code वाली condition की जगह आसानी से use कर सकते हैं।
अब आप PHP में Null coalescing operator के बारे अच्छे से समझ गए होंगे।
Loading ...
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook