Parameter must be an array or an object that implements Countable how fix this?

362 views Asked by At

I have an error this : Warning: count(): Parameter must be an array or an object that implements Countable

public static function setSection( $section, $section_data = array(), $additional_section_data = array() ) {
    if(count($additional_section_data) > 0 && !empty($additional_section_data)){
        $section_data['fields'] = array_merge($section_data['fields'], $additional_section_data);
    }

    self::$sections[ $section ] = $section_data;
}
1

There are 1 answers

1
Roman Nahornyi On

This issue means the variable $section_data isn't an array. Try to use gettype function to find out the type of the var, or var_dump to display it.