Q:

Trouble getting the subject from headerinfo with php

For some reason I am having trouble getting the subject of an email to echo out. Well actually one subject will echo out but only one and not the rest. I have tried solutions from other topics similar but none have worked. THanks in advance. My code is as follows. 
     function inbox() {

        $this->msg_cnt = imap_num_msg($this->conn);

        $in = array();
        for($i = 1; $i <= $this->msg_cnt; $i++) {
            $in[] = array(
                'index'     => $i,
                'header'    => imap_headerinfo($this->conn, $i),
                'body'      => imap_body($this->conn, $i),
                'structure' => imap_fetchstructure($this->conn, $i)
            );
            if(property_exists($this->inbox[$i]['header'], 'subject')){
                $header = $this->inbox[$i]['header'];
                $subject = $header->subject;
                echo $subject;
        }

        $this->inbox = $in;

    }
}

A:

This is simply a guess, but I am going to assume that you are making the $in array for a reason.  You then neglect to use $in.
Here is what I believe you meant to do:
function inbox() {

    $this->msg_cnt = imap_num_msg($this->conn);

    $in = array();
    for($i = 1; $i <= $this->msg_cnt; $i++) {
        $in[$i] = array(
            'index'     => $i,
            'header'    => imap_headerinfo($this->conn, $i),
            'body'      => imap_body($this->conn, $i),
            'structure' => imap_fetchstructure($this->conn, $i)
        );
        if(property_exists($in[$i]['header'], 'subject')){
            $header = $in[$i]['header'];
            $subject = $header->subject;
            echo $subject;
        }

    }
    $this->inbox = $in;
}

