From 82ec0fa0aad5b199020d2a2e760efea8890ea6d0 Mon Sep 17 00:00:00 2001 From: u_mulder Date: Fri, 26 Jun 2020 13:01:57 +0300 Subject: [PATCH] Update class.php Add some spaces and follow the naming convention: `method` and `property` everywhere in comments. --- src/class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/class.php b/src/class.php index 326440d..73f5570 100644 --- a/src/class.php +++ b/src/class.php @@ -2,19 +2,22 @@ class ClassName { - // set/declare property + // declare property public $classname; + + // declare property and init with a value public $number = 1; - // define a method + + // define a method public function setClassName($name) { $this->classname = $name; } } -// Initiate new class Instance: +// Create new class Instance: $classInstance = new ClassName(); -// Use Class function: +// Call class method: $classInstance->setClassName('User'); -// Get Class variable value: +// Get class property value: echo $classInstance->classname;