Skip to content

Instantly share code, notes, and snippets.

@andonovn

andonovn/Person.php

Created Feb 12, 2019
Embed
What would you like to do?
OOP basics
<?php
require 'Person.php';
$pesho = new Person;
$pesho->setHairColor('orange');
$pesho->printHairColor();
$ivan = new Person;
$ivan->setHairColor('black');
$ivan->printHairColor();
<?php
class Person
{
protected $hairColor;
protected $eyeColor;
public function run()
{
echo 'running';
}
public function setHairColor($color)
{
$this->hairColor = $color;
}
public function printHairColor()
{
echo $this->hairColor;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment