Make object available within php functions without passing them or making them global
- by Matt
Hey all,
This requirement is just for simplicity for developers and beautiful code. I'm building a template system and I really would just like an object variable to simply be there in all functions. Here's some code:
Librarian.php:
$class = "slideshow";
$function = "basic";
$args = array(...);
$librarian = $this; // I WOULD LIKE THIS TO BE PRESENT IN CALLED FUNCTION
...
return call_user_func($class.'::'.$function, $args);
...
Slideshow.php:
public static function basic($args) {
echo $librarian; // "Librarian Object"
}
Thanks!
Matt Mueller