Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Class Api {
public static $log;
public static function setLogger($func) {
self::$log = &$func;
public static function errorLog($st) {
$func = &self::$log;
public function doSth() {
self::errorLog('In doSth');
Class Logger {
public static function log($statement) {
printf("%s \r\n", $statement);
Api::errorLog('Hello world');
Api::errorLog('This function is set later');
$api = new Api;
//Api::$log = function ($st) {
// print $st;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment