Well, the actual code is hard to tell. It's grabbed from a db so it
should be an int. But it's also run through some functions. That's why
I'd like a to tell what's going on better.

The variable is always set. Basically

$result = mssql_query($sql);
$row = mssql_fetch_array($result);
$var = $row[0];

So it should be an int. And if it's copied into a function it
shouldn't be changed.

But doing

if($var)

doesn't seem to work after I upgraded versions. Which is making me
think that they changed how that works.

And using is_string() or is_int() is pointless 'cause it doesn't
matter. I just want to know if the value != 0.

The problem is, if 0 gets changed to "0" somewhere throughout. That's
why I've always used if($var) because it's usually not cared what the
type is, but it seems to now.



On Tue, 13 Jul 2004 19:39:09 +0000, Curt Zirzow
<[EMAIL PROTECTED]> wrote:
> * Thus wrote Josh Close:
> > I've noticed that in the last release of php 4.3.7 (or 5.0.0), that
> > when checking the value of a variable has changed.
> >
> > ex:
> >
> > if($var){ /* do something */ }
>  
> These values will all *not* do something:
> 
>   var_dump((bool) 0);
>   var_dump((bool) array());
>   var_dump((bool) "");
>   var_dump((bool) "0");
>   var_dump((bool) null);
>   var_dump((bool) false);
> 
> 
> > doesn't work anymore. I've had to change code to
> >
> > if($var > 0)
> 
> what is the actual value of $var?
> 
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid schemes
> you've been hearing about.  No, sir.  Our model is the trapezoid!
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
-Josh

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

Reply via email to