File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,52 @@ echo strtoupper($d)
219219 print join(",",$the_array)
220220
221221
222+
223+
224+ <?php
225+ function greetings($name)
226+ {
227+ echo "Greetings, " .$name . "!";
228+ }
229+ greetings('anand');
230+ ?>
231+
232+
233+
234+
235+ <?php
236+ // The code below creates the class
237+ class Person {
238+ // Creating some properties (variables tied to an object)
239+ public $isAlive = true;
240+ public $firstname;
241+ public $lastname;
242+ public $age;
243+
244+ // Assigning the values
245+ public function __construct($firstname, $lastname, $age) {
246+ $this->firstname = $firstname;
247+ $this->lastname = $lastname;
248+ $this->age = $age;
249+ }
250+
251+ // Creating a method (function tied to an object)
252+
253+ }
254+
255+ // Creating a new person called "boring 12345", who is 12345 years old ;-)
256+ $teacher = new Person('boring', '12345', 12345);
257+ $student = new Person('aabording', 'a12345', 212345);
258+
259+ echo $student->age;
260+
261+ // Printing out, what the greet method returns
262+ ?>
263+
264+
265+
222266sudo -i -u postgres
267+
223268 createdb mm
224269
225270 psql
You can’t perform that action at this time.
0 commit comments