Re: if (empty versus if (isset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



isset checks if something is defined or if an array has a key with a value other
than null

read:
http://www.php.net/manual/en/function.isset.php#refsect1-function.isset-returnvalues

empty check isset PLUS if the value is not null, false, 0 and wahtever php
thinks is empty

read:
http://www.php.net/manual/en/function.empty.php#refsect1-function.empty-returnvalues

You should also checkout array_key_exists

read: http://www.php.net/manual/en/function.array-key-exists.php

> John Taylor-Johnston <John.Taylor-Johnston@xxxxxxxxxxxxxxxxxxxxx> hat am 20.
> Februar 2013 um 03:29 geschrieben:
>
>
> What is the difference between?
>
> if (empty... http://www.php.net/manual/en/function.empty.php "Determine
> whether a variable is empty"
> and
> if (isset... http://php.net/manual/en/function.isset.php "Determine if a
> variable is set and is not *|NULL|*"
>
> I have an <input type="radio" value="something">.
>
> If it is not checked, it is NOT empty, because it has a value, right?
> But it is NOT set, right?
>
> Is this empty, because it's value is ""?
>
> <input type="text" value="">
>
> Just trying to understand ... :)

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: marco@xxxxxxxxxx

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux