Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 23, 2013 16:19
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 shigemk2/5020300 to your computer and use it in GitHub Desktop.
Save shigemk2/5020300 to your computer and use it in GitHub Desktop.
publicとprivateの違い
<?php
class Hoge {
public $fuga = 'fuga';
private $bar = 'bar';
function getBar() {
return $this->bar;
}
}
$hoge = new Hoge();
print_r($hoge->fuga . PHP_EOL); // fuga
print_r($hoge->getBar() . PHP_EOL); // bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment