Re: [PHP] if (empty versus if (isset

[email protected] ("[email protected]")
Newsgroups php.general
Message-ID <[email protected]>
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 <[email protected]> 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: [email protected]

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

http://www.behnke.biz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.