From: Jason Woofenden Date: Thu, 18 Nov 2010 11:08:05 +0000 (-0500) Subject: made file_run() able to pass args X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=e7a6624958150b529f4c4333190e8d031464baf8 made file_run() able to pass args --- diff --git a/file_run.php b/file_run.php index 295900c..e501668 100644 --- a/file_run.php +++ b/file_run.php @@ -33,12 +33,13 @@ # 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); } }