I\'ve written a PHP function that can accepts 10 parameters, but only 2 are required. Sometimes, I want to define the eighth parameter, but I don\'t want to type in empty st
What I have done in this case is pass an array, where the key is the parameter name, and the value is the value.
$optional = array( "param" => $param1, "param2" => $param2 ); function func($required, $requiredTwo, $optional) { if(isset($optional["param2"])) { doWork(); } }