Last active
August 29, 2015 14:27
-
-
Save philbirnie/8d0e601157b40f598c3e to your computer and use it in GitHub Desktop.
PHP Book - The Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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