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
You could have a function that you use:
That way you won’t have to continually add the global statement to each function.
Is that what you meant?