This is a simplified version of a very large user-defined function I have...
function validate_promotional_code($code, $params = ["reference" => "code", "input-type" => "single", "delimiter" => ","]) {
global $node_connection;
$operator_array = [
"Free With Purchase",
"Buy One Get One Free"
];
return $params;
}
I have used this method of passing an associative array with default values into a user-defined function many times. It lets me set default values for my function without having to worry about which variable is where, etc.
Unfortunately, this function returns nothing, where it should return the $params array containing my default values.
Have I made a syntax error? Why is my function not receiving my default values?