Print Out all Arguments in a Function php
This post will show you How to Print Out All Arguments in a Function
1st Method
<?php function noArgument(){ //Get the Arguments Length $argumentLen = func_num_args(); // Get argument List $arg_list = func_get_args(); // Loop Through and Print out Arguments for ($i = 0; $i < $argumentLen; $i++) { echo "Argument $i is: " . $arg_list[$i] ."<br>"; } } noArgument(7,8,9,10); ?>
2nd Method
<?php function dsiplayNumber(...$numbers){ // Loop through the Numbers foreach($numbers as $key => $tableFieldName){ echo "The $key Argument is $tableFieldName " . "<br>"; } } dsiplayNumber(1,2,3); ?>