Netbeans is just an IDE so it may complain about something even though the syntax is perfectly legal php syntax (which does not look correct in this case)
So try to run your function. Do you get any php errors?
The function signature should be like this:
function generateSurveyItem($dbc, $questionNo, $articleSurveyQuestionID, $surveyResponse=NULL, $myParam){
}
You can them call this function the way you do now and the $errors[$articleSurveyQuestionID] that you pass to function will become the value of $myParam inside your function.
You’re not allowed to create an argument for a function in the form of an array key like above (which will result in a parse error). Just call the last argument as $errors, and then pass the $errors[$articleSurveyQuestionID] variable as a parameter to it:
function generateSurveyItem($dbc, $questionNo, $articleSurveyQuestionID, $surveyResponse=NULL, $errors){
}