add php tag + update coding style (#26602)
should use all camel case for method
This commit is contained in:
committed by
Randell Dawson
parent
caf6d3446f
commit
063257939b
@ -16,16 +16,16 @@ class Lab { // class keyword is mandatory identifier for class creation, after c
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function say_my_name() {
|
public function sayMyName() {
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$breaking_bad = 'Heisenberg';
|
$breakingBad = 'Heisenberg';
|
||||||
$lab = new Lab(); // keyword new creates instance of Lab class, variable $lab points to that instance
|
$lab = new Lab();
|
||||||
$lab->setName($breaking_bad); // $lab variable that points to Lab instance calls setter function setName with $breaking_bad as parameter
|
$lab->setName($breakingBad);
|
||||||
echo "My Name is " . $lab->say_my_name(). "!";
|
echo "My Name is " . $lab->sayMyName(). "!";
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user