wpdb returns ids as string instead of int

I am trying to get favorite post ids from my table with get_col, but the results return ids as string instead of int. How can i get them directly as int ?

$sql = "SELECT post_id FROM {$table} $where
            GROUP BY post_id
            ORDER BY post_type
            LIMIT $offset, $count";
$wpdb->get_col( $sql );

Image: http://s16.postimg.org/b2khhvlxx/wpdb_Untitled_1.jpg

Related posts

Leave a Reply

1 comment

  1. Thank you for the comments.
    To answer my own question; there is no way to return the result as int, since this is the default behaviour of wp.
    So you can either use wp’s native function: absint($result[$item]), or $result_int = array_map(‘intval’,$result);
    I went with the latter.