PHP null In Hindi | PHP is null Function
PHP Program to check whether number is Palindrome or not | PHP Find Palindrome Number
PHP Error Control Operator In Hindi | Error Control In PHP
PHP Interview Questions In Hindi : PHP Interview Preparation
Password Strength Checker In jQuery In Hindi
Linux ls command and it's options
Java program to check prime number : find prime number in Java
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.
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