添加其他参数时出现HTTP 500错误

I have the following function:

 function displayData($array, &$htmlCode){
    $numOfQuestions = findNumOfQuestions($array);
    for($i = 1; $i <= $numOfQuestions; $i++){
        $htmlCode .= "<div class='question'><h2>Question: $i</h2>";
        foreach($array as $val){
            if(intval(substr($val, 0, 1)) == $i){
                $val = str_replace("$i > ", "", $val);
                $htmlCode .= $val.'<br>';
            }
        }
        $htmlCode .= "</div>";
    }
}

as far as the functionality of this function, everything works. except when I want to add another variable to the parameters in order to use it in the function I get an HTTP 500 error on xampp.

this is what I want to do:

function displayData($array, &$htmlCode, $questions){
    // same function as one above just with another parameter
}

just adding another parameter throws the http 500 error and I don't know why... The value I put into that $questions parameter is a string that is being read in from a MySQL database. I want to do other things inside the function using the $questions variable but I cant because that error is being thrown. If anyone can help, it would be super awesome! :)

Dont forget to add parameter when calling the method.