note 24416 added to function.extract

From: Date: Thu, 15 Aug 2002 16:36:47 +0000
Subject: note 24416 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-35076@lists.php.net to get a copy of this message
If you ever want to get lazy when passing variables to functions, you might try this procedure which dumps all defined variables into one array, passes the one array to a function and splits it back into the original variables: function my_function($all_vars) { extract($all_vars); //meat of function } $all_vars=get_defined_vars(); my_function($all_vars); This is a lot easier than passing 10 arguments and having to type them for the function definition and all the function calls in your program. This also helps if you generate variable numbers of arguments, haven't planned ahead for them, and the beta code is due by 5:00. -- http://www.php.net/manual/en/function.extract.php http://master.php.net/manage/user-notes.php?action=edit+24416 http://master.php.net/manage/user-notes.php?action=delete+24416 http://master.php.net/manage/user-notes.php?action=reject+24416

« previous php.notes (#35076) next »