Re: Stupid is as Stupid does
| From: | Ondrej Kulaty | Date: | Fri, 27 Feb 2009 07:31:29 +0000 |
| Subject: | Re: Stupid is as Stupid does | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288905@lists.php.net to get a copy of this message | ||
Use var_dump() to see contents of a variable. It will print something even
if variable is empty or undefined.
""Michael A. Peters"" <mpeters@mac.com> píse v diskusním príspevku
news:49A79416.6060208@mac.com...
> As my web app is coming to completion, I added a means to search records
> (different from site search).
>
> This involves reading post input and is many cases converting it to an
> integer.
>
> Damn I feel dumb.
>
> The search app wasn't working, so I did what I often do when
> troubleshooting crap - I put a die($variable) at various points to see if
> the variable is what it is suppose to be.
>
> I kept getting blank returns from die after the conversion from a post
> string to an integer. I looked in the apache logs, system logs, I even
> tried rebooting - I couldn't figure why the smurf the variable wasn't
> converting to integer.
>
> I even turned off eaccelerator in case that was causing it, though it
> never has given me issue before (except once when I was doing something in
> a really shoddy way - cleaned up my method and it behaved)
>
> After several hours contemplating if I had bad RAM, an issue with the CPU,
> verifying my RPMs were good, wondering why I wasn't getting anything in
> the logs, it dawned on me.
>
> If variable is an integer, die($var) returns nothing and is suppose to
> return nothing, it takes a string as an argument to echo on death -
> die("$var") is what I wanted.
>
> I need sleep.
>
> I did finally find the error and fix the record search problem.