Can we pass an array as parameter in any function in PHP? -


I have a function to send mail to users and I give one of its parameters as an array of IDs Want to

Is this possible? If yes, how can this be done?

Suppose we have the function:

  function text message ($ id, $ userid) {} ​​  $ id  should be an array.   

You can pass an array in the form of logic, it is copied by value (or Which essentially means to you), so that you can like array_pop () (and similar) to everyone and nothing will affect it beyond.

  function sendemail ($ id, $ userid) {// ...} sendemail (array ('a', 'b', 'c'), 10);   

You can actually accept only one array by entering its type in the logic signature of the function ...

  function sendemail (array $ id, $ Userid) {// ...}   

You can also call the function as an array with your arguments ...

  Call_user_func_array ('sendemail', array ('argument1', 'argument2'));    

Comments