php get params function code example
Example 1: php get all function arguments
<?php
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs \n";
if ($numargs >= 2) {
echo "Second argument is: " . func_get_arg(1) . "\n";
}
$arg_list = func_get_args();
for ($i = 0; $i < $numargs; $i++) {
echo "Argument $i is: " . $arg_list[$i] . "\n";
}
}
foo(1, 2, 3);
?>
Example 2: get parameter php
<a href="index.php?id=<?php echo $my_id;?>&name=<?php echo $my_name;?>Click</a>
<?php
$id = intval($_GET['id']);
$name = strval($_GET['name']);
?>