Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created September 4, 2012 10:19
Show Gist options
  • Select an option

  • Save assertchris/3619634 to your computer and use it in GitHub Desktop.

Select an option

Save assertchris/3619634 to your computer and use it in GitHub Desktop.
Wonderful PHP object creation!
$obj = new Generic([
"var1" => "foo",
"var2" => "bar",
"func1" => function()
{
echo $this->var1;
},
"func2" => function()
{
echo $this->var2;
}
]);
$obj->var1 = "something";
$obj->func1(); # outputs "something"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment