Skip to content

Instantly share code, notes, and snippets.

@andyfriesen
Created February 7, 2014 01:38
Show Gist options
  • Save andyfriesen/8856030 to your computer and use it in GitHub Desktop.
Save andyfriesen/8856030 to your computer and use it in GitHub Desktop.
PHP and function indirection
<?php
class C {
public function call_private_function($f) {
return $f();
}
private function run() {
echo "run!\n";
}
}
$c = new C;
$c->call_private_function(array($c, 'run'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment