Home › Forums › Back End › PHP define function as array › Re: PHP define function as array
June 21, 2009 at 10:18 am
#59416
davesgonebananas
Member
Not sure. You can pass an array to a php function and access it like any array.
Code:
$arr = array(“one”, “two”, “three”);
help($arr);
function help($args) {
foreach ($args as $arg) {
echo $arg . “n”;
}
}
Or you can access the list of passed variables using fung_get_args().
Code:
help2(“one”, “two”, “three”);
function help2() {
foreach( func_get_args() as $arg) {
echo $arg . “n”;
}
}