how to check varible is empty in php

It is for static page, dynamic page, website, SEO, performance and other web development discussion
Joshi jahanvi

how to check varible is empty in php

Postby Joshi jahanvi » Thu Oct 30, 2014 5:35 pm

How do I check if a given variable is empty?


sonall gajera

Re: how to check varible is empty in php

Postby sonall gajera » Wed Jul 08, 2015 9:59 am

"empty — Determine whether a variable is empty"

bool empty ( mixed $var ) Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist.

The following things are considered to be empty:
[1] "" (an empty string)
[2] 0 (0 as an integer)
[3] 0.0 (0 as a float)
[4] "0" (0 as a string)
[5] NULL
[6] FALSE
[7] array() (an empty array)
[8] $var; (a variable declared, but without a value)


Return to “PHP, HTML, MYSQL and Web Hosting”

Who is online

Users browsing this forum: No registered users and 3 guests