Create Function with variable number of argument in PHP
Description
The following code shows how to create Function with variable number of argument.
Example
/*w w w . ja v a2s. c om*/
<?php
function makeList()
{
print("<ol>\n");
for($i=0; $i < func_num_args(); $i++)
{
print("<li>" . func_get_arg($i) . "</li>\n");
}
print("</ol>\n");
}
makeList("Linux", "Apache", "MySQL", "PHP");
?>
The code above generates the following result.