actually so does empty end up testing true on an empty var... thats because empty thinks "" or string(0) is actually a string just blank... a trick to do with empty is use !empty which will say if the string is at least 1 char long other wish if it is less than 1 char long even though a string does exist then it must be empty.. because: if(empty(var)){ echo "its blank";//eek doesnt work cuz string does exist }else{ echo "something in there";//defaults regardless string(0)"" //is a string so above block will never be used //im sort of confused because: if(!empty(var)){ echo "something in there";//it works for a wierd reason }else{ echo "its blank"//works if string(0)"" or null exists } its strange that !empty will always return a 0 char string/null as false but empty it doesnt care its always true regardless... any reason for that? cuz im confused as to why you have to use !empty instead of empty
----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 06, 2003 9:50 AM Subject: Re: [PHP] empty and isset > > Actually, I believe it's not a matter of the input being set, but the fact > that isset() returns true on an empty variable. > > > > > Jason Wong > <php-general@grem To: [EMAIL PROTECTED] > lins.biz> cc: > Subject: Re: [PHP] empty and isset > 02/06/2003 12:31 > AM > Please respond to > php-general > > > > > > > On Thursday 06 February 2003 13:20, Bryan Lipscy wrote: > > Env: Slackware 8.1, Apache 1.3.27, PHP 4.3.0 > > Bugs: None found for these issues. > > > > I am running to this same problem. The isset() function appears to have > > problems with the empty text value. The empty() function sees the value > > of $_POST['q1'] as expected. > > > > So why is both isset() and empty() returning true on q1? > > <input> of type text are set regardless of whether you have entered > anything. > Thus isset() returns true. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > ------------------------------------------ > /* > Have you noticed that all you need to grow healthy, vigorous grass is a > crack in your sidewalk? > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php