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

后端 未结 12 615
感动是毒
感动是毒 2021-02-02 06:56

I have a function to send mail to users and I want to pass one of its parameter as an array of ids.

Is this possible to do? If yes, how can it be done?

Suppose w

12条回答
  •  醉梦人生
    2021-02-02 07:39

    Its no different to any other variable, e.g.

    function sendemail($id,$userid){
      echo $arr["foo"]; 
    }
    
    $arr = array("foo" => "bar");
    sendemail($arr, $userid);
    

提交回复
热议问题