JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
made file_run() able to pass args
authorJason Woofenden <jason@jasonwoof.com>
Thu, 18 Nov 2010 11:08:05 +0000 (06:08 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Thu, 18 Nov 2010 11:08:05 +0000 (06:08 -0500)
file_run.php

index 295900c..e501668 100644 (file)
 #           return array('me', 'secret');
 #     }
 
-function file_run($filename) {
+function file_run($filename /* args... */) {
+       $args = array_slice(func_get_args(), 1);
        require_once($filename);
        $func = basename($filename, '.php') . '_main';
 
        if(function_exists($func)) {
-               return $func();
+               return call_user_func_array($func, $args);
        }
 }