Recently looking in Drupal’s source code I found the func_get_args function. It is quite a powerful function for newer version of php
It basically takes in a random number of arguments and parses them in an argument array.
Basically, here’s what how it works
function foo_bar() {
$args = func_get_args;
for($i = 0; $i< count($args; $i++)
{
echo $args[$i] . '< br/ > ';
}
foo_bar('monday', 'tuesday', 'wednesday');
The above function call will return
monday
tuesday
wednesday
It works very much like passing in an array as a parameter except it's less clunky.
function foo_bar($args = array())
{
for($i = 0; $i < count($args); $i++)
{
echo $args[$i] . '< br/ > ';
}
}
foo_bar(array('Monday', 'Tuesday', 'Wednesday'));
Chang is a 20 some years old web technology enthusiast, he loves open source web application design and development. In his spare times, he loves to explore new technologies, web 2.0 and its business implications,