Skip to content

Instantly share code, notes, and snippets.

@Palleas
Forked from ubermuda/protected_composition.php
Created January 7, 2010 14:42
Show Gist options
  • Save Palleas/271257 to your computer and use it in GitHub Desktop.
Save Palleas/271257 to your computer and use it in GitHub Desktop.
<?php
class Car
{
protected $oilLevel;
protected function checkOilLevel()
{
echo "oil level checked : ";
echo $this->oilLevel;
echo "\n";
}
public function thisWorks()
{
$car = new Car();
$car->oilLevel = 'w00t!';
$car->checkOilLevel();
}
}
$car = new Car();
$car->thisWorks(); // prints "oil level checked and oil level"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment