Skip to content

Instantly share code, notes, and snippets.

@eteubert
Created July 13, 2013 14:26
Show Gist options
  • Select an option

  • Save eteubert/5990894 to your computer and use it in GitHub Desktop.

Select an option

Save eteubert/5990894 to your computer and use it in GitHub Desktop.
<?php
class Foo {
public function bar() {
// ok
$this->bar();
// nicht ok, weil $foo in einer anonymen Funktion steht und der Kontext der Klasse fehlt
add_action('init', function() {
$this->foo();
})
}
public function foo() {
echo 42;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment