PHP Programing language

How can Get parameter count from func_num_args
Previous Home Next
<html>
<head>
<title>Get parameter count from func_num_args()</title>
</head>
<body>
<h1>Get parameter count from func_num_args()</h1>
<?
function addNums() {
    $ret = "<table>";
    for ($x=0; $x<func_num_args (); $x++) {
        $arg = func_get_arg ($x);
        $result += $arg;
        $ret .= "<tr><td>number ". ($x+1).": 
		</td><td>$arg</td></tr>";
    }
    $ret .= "<tr><td>result: </td><td>$result</td><tr>";
    $ret .= "</table>";
    return $ret;
}

print addNums (19, 20, 34, 42, 75);
?>
</body>
</html>

 

Output:

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: