Re: Force variables to add

From: Date: Mon, 08 Jan 2001 19:36:45 +0000
Subject: Re: Force variables to add
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33288@lists.php.net to get a copy of this message
you've made php think you're using strings, so it's concatenating them. try this (note, no quotes): $var1 = 2; $var2 = 3; $var3 = $var1 + $var2; ----------------------------------------------------------------- Jonathan Rosenberg Be fierce, be fabulous, change the world! ----- Original Message ----- From: "Brandon Orther" <brandon@webintellects.com> To: "PHP User Group" <php-general@lists.php.net> Sent: Saturday, January 08, 2000 2:37 PM Subject: [PHP] Force variables to add > 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 > brandon@webintellects.com > 800-994-6364 > www.webintellects.com > -------------------------------------------- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#33288) next »