Guest User

Untitled

a guest
Jul 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. require 'index.view.php';
  4.  
  5. class Product {
  6. public $description;
  7.  
  8. protected $available = true;
  9.  
  10. public function __construct($description)
  11. {
  12. $this->description = $description;
  13. }
  14.  
  15. public function unavailable()
  16. {
  17. $this->available = false;
  18. }
  19.  
  20. public function isAvailable()
  21. {
  22. return $this->available;
  23. }
  24. }
  25.  
  26. $products = [
  27. new Product('Oriental Herbal Nutrient'),
  28. new Product('Lactobacillus Serum'),
  29. new Product('Dandelion FPJ')
  30. ];
  31.  
  32. $products[0]->unavailable();
Add Comment
Please, Sign In to add comment