$object = "나는 일단 object라고 가정하고..."; foreach((array)$object as $key => $value) { ...do something... } echo count((array)$object);