I can't get in_array to work. Its running inside a function which is defined in a file I have included, and then call the function from the original file... This is getting too complex, I will add the code:
index.php
$results = $database->get_results($query);
foreach ($results as $question) {
    echo '<div class="'.addQuestionClass($question).'"></div>';
}
functions.php
$sectionConfig = array(
    'amount' => '20',
    'types' => array('textarea', 'text', 'select', 'number'),
);
function addQuestionClass($question) {
    if(is_array($question)) {
        $order = 'order-'.$question['order'];
        $id = ' question-'.$question['id'];
        if(in_array($question['answer'], $sectionConfig['types'])) {
            $answertype = ' type-'.$question['answer'];
            echo 'true';
        } else {
            $answertype = null;
            echo 'false';
        }
        return $answertype;
    } else {
        return;
    }
}
The problem code is in my addClass function:
in_array($question['answer'], $sectionConfig['types'])
If I run the same code, with the array from $sectionConfig pasted in, like below, it works fine, but it never recognises in the format I have it above.
this works:
in_array($question['answer'], array('textarea', 'text', 'select', 'number'))
 
     
    