Jump to content

Monica22

New Members
  • Posts

    5
  • Joined

  • Last visited

Monica22's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you sooo much... that helps me a lot
  2. So basically my vehicle 1 & vehicle 2 lines are all running together...
  3. A little more help if possible... My page is not giving me line breaks- any idea why? <?php include('../lib/vehicle.php'); $vehicle1 = new vehicle(); $vehicle2 = new vehicle("122445566778899", "Ford", "Edge", "Black", 50000); echo "<b>Returning Vehicle Properties:</b><br> />"; echo "<b> Vehicle 1:</b>"; echo "Vin:" . $vehicle1->getvin() . " "; echo "Manufacturer:" . $vehicle1->getmanufacturer() . " "; echo "Type:" . $vehicle1->gettype() . " "; echo "Color:" . $vehicle1->getcolor() . " "; echo "Price:" . $vehicle1->getprice() . " "; echo "<b> Vehicle 2:</b> "; echo "Vin:" . $vehicle2->getvin() . " "; echo "Manufacturer:" . $vehicle1->getmanufacturer() . " "; echo "Type:" . $vehicle2->gettype() . " "; echo "Color:" . $vehicle2->getcolor() . " "; echo "Price:" . $vehicle2->getprice() . " "; echo "<b> Vehicle2 (After Changing Property Values):</b> "; echo "Vin:" . $vehicle2->getvin() . " "; echo "Manufacturer:" . $vehicle1->getmanufacturer() . " "; echo "Type:" . $vehicle2->gettype() . " "; echo "Color:" . $vehicle2->getcolor() . " "; echo "Price:" . $vehicle2->getprice() . " "; "<br />"; ?>
  4. Thanks...
  5. Hi I am new to this site and was hoping to get a little help. I am in the learning stages and creating an object-oriented programming using php. I have two files, an idex file and a vehicle.php file. I keep getting the following errors: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in/home/msj03/html/lis5367/lib/vehicle.php on line 92 The last line, the one in red is line 92- can anyone help? Thanks, <?php //define class class vehicle1 { //private properties (class variables) private $vin; private $manufacturer; private $type; private $color; private $price; //public methods/functions //default constructor public function __construct($vin="12345678901234567", $manufacturer="Toyota", $type="Tundra", $color="White", $price=25000) { $this->vin = $vin; $this->manufacturer = $manufacturer; $this->type = $type; $this->color = $color; $this->price = $price; } function __destruct() { //unset($this); echo "Destroying " . $this->vin . "<br />"; } //value-returning functions //getter methods/functions (get object's properties) public function getvehicle1() { return $this->vin . " " . $this->manufacturer . " " . $this->type . " " . $this->color . " " . $this->price . " " ; } public function getvin() { return $this->vin; } public function getmanufacturer() { return $this->manufacturer; } public function gettype() { return $this->type; } public function getcolor() { return $this->color; } public function getprice() { return $this->price; } //setter methods/functions (set object's properties) public function setvin($vin) { $this->vin = $vin; } public function setmanufacturer($manufacturer) { $this->manufacturer = $manufacturer; } public function settype($type) { $this->type = $type; } public function setcolor($color) { $this->color = $color; } public function setprice($price) { $this->price = $price; }//end class ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.