y yannick@mccabecosta:~
available for projects · Macclesfield, UK

PHP Functions of Contention

Information on PHPs isset(), empty() and is_null() functions; and the differences in responses.
Value of Variable isset() empty() is_null()
"" (an empty string) bool(true) bool(true)
" " (space) bool(true)
FALSE bool(true) bool(true)
TRUE bool(true)
array() (an empty array) bool(true) bool(true)
NULL bool(true) bool(true)
"0" (0 as a string) bool(true) bool(true)
0 (0 as an integer) bool(true) bool(true)
0.0 (0 as a float) bool(true) bool(true)
var ; (a variable declared, but without a value) bool(true) bool(true)
NULL byte ("") bool(true)

Information

This page has been created as I kept losing where I found this on the internet. It covers certain PHP functions that have interesting functionality.


It's originally from https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ so thanks to them for that page! Super useful.

# site terms

Whilst all of the information on this page is provided for ease of contact for legitimate reasons, it is not to be added to any databases or mailing lists without express, written consent. This is very rigorously enforced and communications deemed as marketing or cold/non opt-in will be reported to the Information Commissioner's Office. Every care has been taken to ensure the validity and legitimacy of external links, however no responsibility is taken for external content.

# data protection

The data custodian for all information this site may process is Yannick McCabe-Costa, a registered data controller (registration number ZB861623). Forms on this website are submitted via a POST request using HTTPS and TLS; no data is sent in the clear. This site uses Cloudflare and therefore your data may be proxied via their servers. Analytics data is stored with Google Analytics.

As expressed in the site terms, the information given here is for professional use only. No data is to be added to a database, mailing list or other such data store without express written consent. Any person or company contravening this will be reported to the Information Commissioner's Office.