Skip to content

Instantly share code, notes, and snippets.

@tmountain
Created April 21, 2015 20:27
Show Gist options
  • Save tmountain/e2c8a36c236cdca16db5 to your computer and use it in GitHub Desktop.
Save tmountain/e2c8a36c236cdca16db5 to your computer and use it in GitHub Desktop.
<?php
class Foo
{
private $bar;
public $car;
public function __construct($arg1 = 'bar', $arg2 = 'car')
{
$this->bar = $arg1;
$this->car = $arg2;
}
public function getBar()
{
return $this->bar;
}
}
$foo = new Foo();
echo "car: " . $foo->car . "\n";
echo "getBar: " . $foo->getBar() . "\n";
$foo->bar;
$foo2 = new Foo('fuck', 'you');
echo "car: " . $foo2->car . "\n";
$foo3 = array('foo' => 'f00', 'car' => 'c4r');
echo "car: " . $foo3['car'] . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment