PHP Programing language

adplus-dvertising
How Can accessing function parameters without using the argument list
Previous Home Next
<html>
<head>
<title>accessing function parameters without 
using the argument list  </title>
</head>
<body>
<h1>accessing function parameters without 
using the argument list</h1>
<?php
function mean() {
    $sum = 0;

    $size = func_num_args();

    for ($i = 0; $i < $size; $i++) {
        $sum += func_get_arg($i);
    }

    $average = $sum / $size;

    return $average;
}

$mean = mean(18, 28, 38);
?>
</body>
</html>

Output:

Previous Home Next