{"id":688,"date":"2012-01-21T16:12:51","date_gmt":"2012-01-22T00:12:51","guid":{"rendered":"http:\/\/virendrachandak.wordpress.com\/?p=688"},"modified":"2025-12-17T09:51:25","modified_gmt":"2025-12-17T17:51:25","slug":"php-isset-vs-empty-vs-is_null","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/","title":{"rendered":"PHP isset() vs empty() vs is_null()"},"content":{"rendered":"<p>PHP has different functions which can be used to test the value of a variable. Three useful functions for this are <strong>isset()<\/strong>, <strong>empty()<\/strong> and <strong>is_null()<\/strong>. All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results.<\/p>\n<p>isset() and empty() are often viewed as functions that are opposite, however this is not always true. In this post I will explain the differences between these functions.<\/p>\n<p><!--more--><\/p>\n<div>\n<h4>isset()<\/h4>\n<p>From <a title=\"PHP Manual - isset()\" href=\"http:\/\/www.php.net\/manual\/en\/function.isset.php\" target=\"_blank\" rel=\"external nofollow noopener noreferrer\">PHP manual &#8211; isset()<\/a>:<\/p>\n<blockquote><p>isset \u2014 Determine if a variable is set and is not NULL<\/p>\n<\/blockquote>\n<p>In other words, it returns <strong>true<\/strong> only when the variable is <strong>not null<\/strong>.<\/p>\n<\/div>\n<div>\n<h4>empty()<\/h4>\n<p>From <a title=\"PHP Manual - empty()\" href=\"http:\/\/www.php.net\/manual\/en\/function.empty.php\" target=\"_blank\" rel=\"external nofollow noopener noreferrer\">PHP Manual &#8211; empty()<\/a>:<\/p>\n<blockquote><p>empty \u2014 Determine whether a variable is empty<\/p>\n<\/blockquote>\n<p>In other words, it will return <strong>true<\/strong> if the variable is an empty string, false, array(), NULL, \u201c0?, 0, and an unset variable.<\/p>\n<\/div>\n<div>\n<h4>is_null()<\/h4>\n<p>From <a title=\"PHP Manual - is_null()\" href=\"http:\/\/www.php.net\/manual\/en\/function.is-null.php\" target=\"_blank\" rel=\"external nofollow noopener noreferrer\">PHP Manual &#8211; is_null()<\/a>:<\/p>\n<blockquote><p>is_null \u2014 Finds whether a variable is NULL<\/p>\n<\/blockquote>\n<p>In other words, it returns <strong>true<\/strong> only when the variable is <strong>null<\/strong>. is_null() is opposite of isset(), except for one difference that isset() can be applied to unknown variables, but is_null() only to declared variables.<\/p>\n<\/div>\n<div>The table below is an easy reference for what these functions will return for different values. The blank spaces means the function returns <strong>bool(false)<\/strong>.<\/div>\n<table border=\"1px solid\">\n<tbody>\n<tr>\n<th>Value of variable ($var)<\/th>\n<th>isset($var)<\/th>\n<th>empty($var)<\/th>\n<th>is_null($var)<\/th>\n<\/tr>\n<tr>\n<td>&#8220;&#8221; (an empty string)<\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>&#8221; &#8221; (space)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>FALSE<\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>TRUE<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>array() (an empty array)<\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><tt>NULL<\/tt><\/td>\n<td><\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<\/tr>\n<tr>\n<td>&#8220;0&#8221; (0 as a string)<\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>0 (0 as an integer)<\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>0.0 (0 as a float)<\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><em>var $var;<\/em>&nbsp;(a variable declared, but without a value)<\/td>\n<td><\/td>\n<td>bool(true)<\/td>\n<td>bool(true)<\/td>\n<\/tr>\n<tr>\n<td><tt>NULL<\/tt>&nbsp;byte (&#8220;\\ 0&#8221;)<\/td>\n<td>bool(true)<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>I have tested the above values in following PHP versions:<\/p>\n<div>\n<div>\n<ul>\n<li>PHP 8.5.0<\/li>\n<li>PHP 8.4.15<\/li>\n<li>PHP 7.4.13<\/li>\n<li>PHP 7.3.17<\/li>\n<li>PHP 7.2.13<\/li>\n<li>PHP 7.0.9<\/li>\n<li>PHP 5.6.19<\/li>\n<li>PHP 5.5.33<\/li>\n<\/ul>\n<\/div>\n<div><a id=\"demo_link\" data-title=\"View Demo\" href=\"http:\/\/www.virendrachandak.com\/demos\/php-isset-vs-empty-vs-is_null.php\"> View Demo<\/a><br \/>\n<a id=\"source_link\" data-title=\"Download Source Code\" href=\"http:\/\/www.virendrachandak.com\/demos\/php-isset-vs-empty-vs-is_null.zip\"> Download Source Code<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PHP has different functions which can be used to test the value of a variable. Three useful functions for this are isset(), empty() and is_null(). All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results. isset() and empty() are often viewed as functions that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[143,8],"tags":[33,43,44,12],"class_list":["post-688","post","type-post","status-publish","format-standard","hentry","category-php","category-web-development","tag-empty","tag-isset","tag-is_null","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PHP isset() vs empty() vs is_null() - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Difference between PHP&#039;s isset, empty and is_null functions which can be used to test the value of a variable, array, string\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP isset() vs empty() vs is_null() - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Difference between PHP&#039;s isset, empty and is_null functions which can be used to test the value of a variable, array, string\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2012-01-22T00:12:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-17T17:51:25+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"PHP isset() vs empty() vs is_null()\",\"datePublished\":\"2012-01-22T00:12:51+00:00\",\"dateModified\":\"2025-12-17T17:51:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/\"},\"wordCount\":329,\"commentCount\":60,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"empty\",\"isset\",\"is_null\",\"PHP\"],\"articleSection\":[\"PHP\",\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/\",\"name\":\"PHP isset() vs empty() vs is_null() - Virendra's TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2012-01-22T00:12:51+00:00\",\"dateModified\":\"2025-12-17T17:51:25+00:00\",\"description\":\"Difference between PHP's isset, empty and is_null functions which can be used to test the value of a variable, array, string\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/php-isset-vs-empty-vs-is_null\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/web-development\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP isset() vs empty() vs is_null()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP isset() vs empty() vs is_null() - Virendra's TechTalk","description":"Difference between PHP's isset, empty and is_null functions which can be used to test the value of a variable, array, string","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/","og_locale":"en_US","og_type":"article","og_title":"PHP isset() vs empty() vs is_null() - Virendra's TechTalk","og_description":"Difference between PHP's isset, empty and is_null functions which can be used to test the value of a variable, array, string","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2012-01-22T00:12:51+00:00","article_modified_time":"2025-12-17T17:51:25+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"PHP isset() vs empty() vs is_null()","datePublished":"2012-01-22T00:12:51+00:00","dateModified":"2025-12-17T17:51:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/"},"wordCount":329,"commentCount":60,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["empty","isset","is_null","PHP"],"articleSection":["PHP","Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/","name":"PHP isset() vs empty() vs is_null() - Virendra's TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2012-01-22T00:12:51+00:00","dateModified":"2025-12-17T17:51:25+00:00","description":"Difference between PHP's isset, empty and is_null functions which can be used to test the value of a variable, array, string","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/php-isset-vs-empty-vs-is_null\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/web-development\/"},{"@type":"ListItem","position":3,"name":"PHP isset() vs empty() vs is_null()"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-b6","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2058,"url":"https:\/\/www.virendrachandak.com\/techtalk\/php-7-null-coalesce-operator\/","url_meta":{"origin":688,"position":0},"title":"PHP 7 &#8211; Null Coalesce Operator","author":"Virendra Chandak","date":"November 1, 2015","format":false,"excerpt":"PHP 7 brings a lot of improvements, features and new operators as compared to the earlier versions on PHP. One of the new operators is the Null Coalesce Operator (??). This operator can be used instead of using isset() along with the ternary operator (?:). The Null coalesce operator (??)\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2375,"url":"https:\/\/www.virendrachandak.com\/techtalk\/null_coalesce_equal_operator\/","url_meta":{"origin":688,"position":1},"title":"PHP 7.4 &#8211; Null Coalesce Assignment Operator","author":"Virendra Chandak","date":"December 22, 2019","format":false,"excerpt":"The Null Coalesce Assignment Operator (??=) assigns the value of the right-hand parameter if the left-hand parameter is null. It is also called as Null Coalesce Equal Operator.","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":699,"url":"https:\/\/www.virendrachandak.com\/techtalk\/get-search-query-string-from-search-engines-using-php\/","url_meta":{"origin":688,"position":2},"title":"Get search query string from search engines using PHP","author":"Virendra Chandak","date":"February 4, 2012","format":false,"excerpt":"I have often come across situations when I would like to implement some functionality based on what the user searched for in a search engine like Google, Bing etc. The search query string is normally passed as GET variables 'q' or 'query'. The function below will return the search query\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1086,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-apply-a-function-to-every-array-element-in-php\/","url_meta":{"origin":688,"position":3},"title":"How to apply a function to every array element in PHP","author":"Virendra Chandak","date":"October 21, 2012","format":false,"excerpt":"I often come across situations in which I need to apply some function to every element of an array in PHP. For example, to sanitize the user input, function like htmlentities can be used. We can easily use this function on a single variable or a single dimension array by\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":450,"url":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/","url_meta":{"origin":688,"position":4},"title":"Getting real client IP address in PHP","author":"Virendra Chandak","date":"October 23, 2011","format":false,"excerpt":"Many times we need the visitor's ipaddress for validation, security, spam prevention, etc. Getting the Visitor's ipaddress is very easy in PHP. The simplest way to get the visitor's\/client's ipaddress is using the $_SERVER['REMOTE_ADDR'] or $_SERVER['REMOTE_HOST'] variables. The variable in the $_SERVER array are created by the web server (like\u2026","rel":"","context":"In &quot;Functionality&quot;","block_context":{"text":"Functionality","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/functionality\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":694,"url":"https:\/\/www.virendrachandak.com\/techtalk\/php-double-quotes-vs-single-quotes\/","url_meta":{"origin":688,"position":5},"title":"PHP double quotes vs single quotes","author":"Virendra Chandak","date":"March 18, 2012","format":false,"excerpt":"Strings in PHP can be specified in four different ways: single quoted, double quoted, heredoc syntax and (since PHP 5.3.0) nowdoc syntax, the first two of them being by far the most frequently used. It is important to know the difference between using single quotes and double quotes. In this\u2026","rel":"","context":"In &quot;Optimization Tips&quot;","block_context":{"text":"Optimization Tips","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/optimization-tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=688"}],"version-history":[{"count":4,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/688\/revisions"}],"predecessor-version":[{"id":2610,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/688\/revisions\/2610"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}