Skip to content

Instantly share code, notes, and snippets.

@tomjn
Last active December 21, 2015 09: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 tomjn/9796bfe1ef0cae28451a to your computer and use it in GitHub Desktop.
Save tomjn/9796bfe1ef0cae28451a to your computer and use it in GitHub Desktop.
<?php
// All of these will fail miserably:
class MyClass {
function __construct() { }
}
// no function named MyClass
add_action( 'admin_init', 'MyClass' );
// not a callable value
$var = new MyClass();
add_action( 'admin_init', array( &$var ) );
// Plain heresey of the highest order, also it's non-working heresey
add_action( 'admin_init', array( &$var, '__construct' ) );
// this isn't a callable value either
add_action( 'admin_init', 'MyClass::__construct' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment