0

Let take following example.

public function do_this($id, $title = NULL, $status = false, $permission = false){

    //Do the task

}

According to above function $title, $status and $permission are optional parameters.

  • If I want to pass just ID, I use do_this(15);
  • If I want to pass Id and Permission I use do_this(15, NULL, false, true);

So even there are three parameters are optional I had to pass all four parameters when I need to use just one optional parameters.

What I am doing is correct or is there way to pass just id and permission parameters.

0 Answers0