or: echo "price * two is ". ($this->UnitPrice*2) . "<br>"; -Mike On Wed, 3 Sep 2003, Ignatius Reilly wrote: > Date: Wed, 3 Sep 2003 17:31:25 +0200 > From: Ignatius Reilly <ignatius.reilly@free.fr> > To: Win32 list PHP <php-windows@lists.php.net>, > Mark Harrington <elite_electronics@ntlworld.com> > Subject: Re: [PHP-WIN] Cant get maths functions to work in class file > > echo() can interpolate a variable, but not an expression such as > "$this->Unitprice*2" > > replace: > echo " price * two is $this->Unitprice*2<BR>"; > > by: > $bytwo = $this->Unitprice*2 ; > echo " price * two is $bytwo<BR>"; > > HTH > Ignatius > _________________________ > ----- Original Message ----- > From: "Mark Harrington" <elite_electronics@ntlworld.com> > To: <php-windows@lists.php.net> > Sent: Wednesday, September 03, 2003 4:54 PM > Subject: [PHP-WIN] Cant get maths functions to work in class file > > > > I have designed a class that multiplies one of the varibles by two but > when > > i pass the values to the contructor i cant get the answer out any ideas > > > > Here is the full script "If you can recognise the problem can you explain > > why its wrong and why its not working "Ps learning the langauge " > > > > The Class File > > > > class purchase { > > > > var $PartNumber; > > var $Description; > > var $Unitprice ; > > > > > > // this is the constuctor > > > > function purchase($partnumber,$desc,$price) > > { > > $this->PartNumber = $partnumber; > > $this->Description =$desc; > > $this->Unitprice =$price; > > echo "Object created partNumber = $this->PartNumber <br>"; > > echo " This Objects Description = $this->Description <br>"; > > echo " This Objects Price is $this->Unitprice <BR>"; > > //this doesnt work why ?? > > echo " price * two is $this->Unitprice*2<BR>"; > > }// end constructor > > > > > > } > > > > > > $myObject = new purchase(1,"Speaker",23.00); > > > > ?> > > > > > > mark@harrington.force9.co.uk > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php