Formatting some data about some airlines function reformat($data, $registration = false) {
    // Initializing aircompanies codes
    $iata = new iata;
    for ($i = 0; $i &lt; count($data); $i = $i + 6) {
        if ($registration) {
            $r = str_replace('&lt;nobr&gt;', '', $this-&gt;prep_value($data[$i]));
            $block[$i]['reis'] = str_replace('&lt;/nobr&gt;', '', $r);
            $a = explode(' ', $block[$i]['reis']);
            $block[$i]['company'] = $a[0];
        } else {
            $r = explode('&amp;nbsp;', $this-&gt;prep_value($data[$i]));
            $block[$i]['reis'] = (strlen($r[0]) &gt; 2) ? strrev(substr(strrev($r[0]), 15, 2)) . ' ' . $r[1] : $r[0] . ' ' . $r[1];
            $block[$i]['company'] = (strlen($r[0]) &gt; 2) ? strrev(substr(strrev($r[0]), 15, 2)) : $r[0];
        }
        $block[$i]['companyname'] = $iata-&gt;aircompanies[strtoupper($block[$i]['company'])];
        if (file_exists(ROOT_HTML_PATH . '/content/aircompanies/' . $block[$i]['company'] . '.png')) {
            $block[$i]['company'] = $block[$i]['company'] . '.png';
        } else {
            /**
             * @todo Write e-mail notifications, but only once;
             */
        }
        $block[$i]['airport'] = $this-&gt;prep_value($data[$i + 1]);
        $block[$i]['terminal'] = substr(strrev($this-&gt;prep_value($data[$i + 2])), 2, 1);
        $block[$i]['shedtime'] = $this-&gt;prep_value($data[$i + 3]);
        $block[$i]['facttime'] = str_replace('&amp;nbsp;', '', $this-&gt;prep_value($data[$i + 4]));
        $block[$i]['status'] = str_replace('&amp;nbsp', '&lt;br /&gt;', trim(strip_tags($this-&gt;prep_value($data[$i + 5]), '&lt;img /&gt;'), '&amp;nbsp;/r/n'));
        $block[$i]['status'] = str_replace(';', '', $block[$i]['status']);
    }
    return $block;
}
function reformat($data, $registration = false) {
    // Initializing aircompanies codes
    $iata = new iata;
    $block = array();
    for ($i = 0; $i &lt; count($data); $i += 6) {
        $block[$i] = array(
            'airport'  =&gt; $this-&gt;prep_value($data[$i + 1]),
            'terminal' =&gt; substr(strrev($this-&gt;prep_value($data[$i + 2])), 2, 1),
            'shedtime' =&gt; $this-&gt;prep_value($data[$i + 3]),
            'facttime' =&gt; str_replace('&amp;nbsp;', '', $this-&gt;prep_value($data[$i + 4])),
            'status'   =&gt; str_replace(';', '', 
                              str_replace('&amp;nbsp', '&lt;br /&gt;', 
                                  trim(
                                      strip_tags($this-&gt;prep_value($data[$i + 5]), '&lt;img /&gt;'), 
                                      '&amp;nbsp;/r/n'
                                  )
                              )
                          ),
        );

        if ($registration) {
            $r = str_replace('&lt;nobr&gt;', '', $this-&gt;prep_value($data[$i]));
            $block[$i]['reis'] = str_replace('&lt;/nobr&gt;', '', $r);
            $a = explode(' ', trim($block[$i]['reis']));
            $block[$i]['company'] = $a[0];
        } else {
            $r = explode('&amp;nbsp;', $this-&gt;prep_value($data[$i]));
            $block[$i]['company'] = (strlen($r[0]) &gt; 2) ? substr($r[0], -17, 2) : $r[0];
            $block[$i]['reis'] = $block[$i]['company'] . ' ' . $r[1];
        }
        $block[$i]['companyname'] = $iata-&gt;aircompanies[strtoupper($block[$i]['company'])];
        if (file_exists(ROOT_HTML_PATH . '/content/aircompanies/' . $block[$i]['company'] . '.png')) {
            $block[$i]['company'] = $block[$i]['company'] . '.png';
        } else {
            /**
             * @todo Write e-mail notifications, but only once;
             */
        }
    }
    return $block;
}


But it is many questions here: 

$this-&gt;prep_value($data[$i + 2])


It is really bad idea. May be you need a little another cycle, like

for ($i = 0; $i &lt; count($data) - 6; $i ++) { // or something for preventing array index overloading


It would be much better.
But I cannot know it for sure.