Skip to content

Instantly share code, notes, and snippets.

@philbirnie
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save philbirnie/8d0e601157b40f598c3e to your computer and use it in GitHub Desktop.

Select an option

Save philbirnie/8d0e601157b40f598c3e to your computer and use it in GitHub Desktop.
PHP Book - The Class
<?php
/* A class is used to create an object - an object is defined by a class */
class ShopProduct {
/** Properties **/
public $title = 'Default Product';
public $producer_last = 'Last Name';
public $producer_first = 'First Name';
public $price = 0;
public function __construct($title, $producer_last, $producer_first, $price) {
$this->title = $title;
$this->producer_last = $producer_last;
$this->producer_first = $producer_first;
$this->price = $price;
}
}
$a = new ShopProduct();
$b = new ShopProduct();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment