|
|
|
How to pass an array as input to an php function |
In part I we have discussed how to return an array from a function. Here we will discuss how to input or pass an array to a function.
We will break an string and create an array. This created array we will pass as input to the function. To test the array inside the function we will display it by using while each command.
Here is the code.
function test($my_array){
while (list ($key, $val) = each ($my_array)) {
echo "$key -> $val <br>";
}
}
$collect_array=split(" ","Hello welcome to plus2net");
test($collect_array);
<< In the part I we discussed on how to return array from an php function.
| |
| Subscribe |
|
Submit your email address and receive
article and product notifications. Your email is safe with us.
|
|
|
|
|
|