Skip to content

Instantly share code, notes, and snippets.

@johnsonch
Created March 26, 2015 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnsonch/47d30074e3be89270d11 to your computer and use it in GitHub Desktop.
Save johnsonch/47d30074e3be89270d11 to your computer and use it in GitHub Desktop.
Simple PHP class example for class
class Car{
public $make;
public $model;
public function getMake(){
return $this->make;
}
public function setMake($input_make){
$this->make = $input_make;
}
public function owner(){
return 'CJ';
}
}
$myCar = new Car;
$myCar->make = 'Ford';
$myCar->model = 'Escape';
echo $myCar->owner(); // CJ
echo $myCar->$make; // Ford
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment