Function overloading

Shows how to "overload" functions

function Test(){
 
    $NumberOfArguments = func_num_args();
 
    for ($x=0; $x < $NumberOfArguments; $x++){
        $Argument = func_get_arg($x);    
        print $Argument . "\n";
    }
 
    // Another way:
 
    print_r(func_get_args());
 
}
Snippet Details



Test('hello','world','foobar');
/*
returns:
hello
world
foobar
*/

Sorry folks, comments have been deactivated for now due to the large amount of spam.

Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!


Older comments:

None.