In article <[EMAIL PROTECTED]>,
"Brandon Orther" <[EMAIL PROTECTED]> wrote:

You will want to apply a cast to the variables to force the addition
to be dealing with numbers.

So, if $var1 = "2" and $var2 = "3",

then 

$var3 = (int) $var1 + (int) $var2;
print($var3); 
 will show 5

see:  http://www.php.net/manual/language.types.type-juggling.php

Jeff


> I have 2 variables, and I want them to add with each other.  But all I
> get is the first variable and then the second variable.  Here is and
> example:
> 
> ------------------------
> $var1 = "2";
> $var2 = "3";
> 
> $var3 = $var1 + $var2;
> 
> echo "$var3";
> 
> OUTPUT = 23
> ------------------------
> 
> Does anyone know how I can forces them to add?
> 
> Thank you,
> 
> --------------------------------------------
> Brandon Orther WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
> 
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to