Re: EMPTY??

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

 



Wow, OK... Can you get this same error reducing a copy of the the script
down to just core PHP, and that scenario?

If so, what version of PHP on what OS is giving you this error?

I have seen PHP give some incredibly wonky errors and sometimes they had
nothing at all to do with the part of the code it was reporting about,
and nothing to do with the message it chose to cough up.  Story of my
joining the list actually.



On Tue, 2007-10-23 at 13:59 -0400, Dan Shirah wrote:
> doing a var_dump($_POST['comments'];
> 
> returns  string(0) ""
> 
> So the value of $comments in $comments = $_POST['comments']; SHOULD be equal
> to 0 or "", right?
> 
> In which case when I do my original:
> 
> if (!empty($comments)) {
>   echo "Do Something";
> }
> 
> It SHOULD just bypass that and continue with my code, but instead it gives
> me the error, "Changed database context to Database."
> 
> 
> On 10/23/07, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
> >
> > On 10/23/07, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:
> > >
> > > I made two variables for the same posted value because I believe empty()
> > > does not work with strtoupper in front of the value. It only works with
> > > a
> > > standalone variable, correct?
> >
> >
> > no; strtoupper modifies its argument, that is all.
> > empty evaluates the argument it is given that is all.
> > therefore, if empty is passed an string with no contents that has been
> > passed through
> > strtoupper, it will still be regarded as empty.
> >
> > <?php
> >     $var = strtoupper('');
> >      if(empty($var)) { echo 'var is empty'; }
> > ?>
> >
> >
> >
> > > When comments is left blank and I echo out the value for $check_comments
> > > it
> > > returns nothing at all which is why I think empty() or "" should work,
> > > but
> > > they don't.
> >
> >
> > try using var_dump(); you will see that it is a string that has no
> > contents, or perhaps some
> > whitespace characters.
> >
> >
> > -nathan
> >
> >
> >

-- 
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