PHP/코드이그나이터4

sizeof(): Parameter must be an array or an object that implements Countable

개발자소니 2021. 2. 4. 00:51

sizeof(): Parameter must be an array or an object that implements Countable

해당 오류는 배열타입인지 오브젝트타입인지 체크를 하지 않아서 생기는 오류라고 합니다.

 

에러코드

sizeof($test);

 

수정코드

if(is_array($test) || is_object($test)){

 sizeof($test); 

}