[PHP-WIN] Cant get maths functions to work in class file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux