Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created September 3, 2012 11:19
Show Gist options
  • Select an option

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

Select an option

Save assertchris/3608631 to your computer and use it in GitHub Desktop.
class Callbacks
{
protected $_callbacks = array(
"cb" => function($value) {
return $value;
}
);
public function call($name, $parameters)
{
if (isset($_callbacks[$name]))
{
return call_user_func_array($this->_callbacks[$name], $parameters);
}
}
}
$new = new Callbacks();
$new->call("cb", array("hello world"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment