Re: Trying to subtract...no luck. (Long Code)

From: Date: Wed, 24 Oct 2001 21:48:24 +0000
Subject: Re: Trying to subtract...no luck. (Long Code)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72173@lists.php.net to get a copy of this message
Jeez michael, i'm sorry but i am not going to go through all of your code. I do have a suggestion for you, without looking at the code. As you know. php has flexible variables. I mean, if you say $a=1 then $a is an integer, if you say $b='i' then $b is a string. Very easy to make code quickly, but for the larger scripts it can be a pit trap. I think that while you intended the variables to be numbers, they somehow turned into strings. Maybe you added a (empty) string somewhere ($a .=''). Several ways to deal with it. First have a look at what is in the variable: echo '<hr>string "a" is ['.$a.']'; i always add something around the string to see spaces. Another thing you can try is to force the value into an integer. I think something like $c= intval($a) - intval ($b); but have a look around the manual to be sure. hth, let me know at my own email if it helped? Chris --------------------------------------------------- ----------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------- -----------------

« previous php.general (#72173) next »