PHP filter_var() Function In Hindi | filter_var() In PHP In Hindi
PHP Error Control Operator In Hindi | Error Control In PHP
PHP com port communication In Hindi | Write on com port in PHP
Optional chaining in JavaScript In Hindi | JS Optional chaining In Hindi
Linux ls command and it's options
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 In Hindi
PHP में null
type एक unit type जिसमे सिर्फ एक ही value है - null
. यह case-insensitive constant value है मतलब इसे आप Null
/ NULL
कैसे भी लिख सकते हैं लेकिन इसे change नहीं कर सकते।
<?php
$x = NULL;
?>
आप null
variable को किसी numeric value से calculation भी कर सकते हैं लेकिन ध्यान रहे इस case में null 0
की तरह work करेगा।
<?php
$num = null;
$num += 10;
echo "{$num} \n";
$num -= 2;
echo "{$num} \n";
$num *= 2;
echo "{$num} \n";
?>
Output :
10 8 16
Important* null values पर increment और decrement operator work नहीं करेंगे।
<?php
$num = null;
++$num; // null
$num++; // null
$num--; // null
--$num; // null
?>
किसी empty Array को आप null से compare भी कर सकते हैं , लेकिन ध्यान रहे non-strict equal (==)
के साथ compare करने पर आपको true
मिलेगा जबकि strict equal (===)
compare करने पर false
.
For Example
<?php
$arr = [];
echo $arr == null ? "true" : "false";
echo "\n";
echo $arr === null ? "true" : "false";
?>
Output :
true false
कोई variable null
है या नहीं ये check करने के लिए is_null()
function का use किया जाता है।
<?php
$x = null;
echo is_null($x) ? "true" : "false";
?>
Output :
true
I Hope, अब आप PHP men null के behavior के बारे में अच्छे से समझ गए होंगे।
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