forked from assembler-institute/oop-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03-methods.php
More file actions
28 lines (22 loc) · 860 Bytes
/
03-methods.php
File metadata and controls
28 lines (22 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
//======================================================================
// ASSEMBLER SCHOOL - PHP Object Oriented Programming
//======================================================================
/* File 03 - Properties */
// in a class we have properties and methods. This methods act like functions and allow classes to develop tasks and functionalities.
class Mobile
{
public $name;
public $chipset;
public $internalMemory;
// method that returns class properties in a string.
public function showSpecs()
{
return $this->name . " includes a " . $this->chipset . " chipset and " . $this->internalMemory . "GB of internal memory";
}
}
$modernMobile = new Mobile();
$modernMobile->name = "Samsung s20";
$modernMobile->chipset = "Exynos";
$modernMobile->internalMemory = 128;
echo $modernMobile->showSpecs();