Refactoring a loop with many boolean conditions
This won't make it shorter, but you might consider changing the condition checking to only do the actual check if needed instead of doing all of them at once, making you loose the advantage of the short-circuiting || operator.

E.g.

if (!isInbox()) continue;
if (!hasPing()) continue;
...




Another possibility, that is even less short, is to create a filtering iterator, e.g.:

class ValidHeaderIterator extends FilterIterator 
{
    private $mailbox;
    private $pincall;   

    public function __construct($headers, $mailbox, $pincall)
    {
        $this-&gt;mailbox = $mailbox;
        $this-&gt;pincall = $pincall;
        parent::__construct(new ArrayIterator($headers));
    }

    public function accept()
    {
        $header = $this-&gt;getInnerIterator()-&gt;current();
        return isInbox($header) &amp;&amp; hasPin($header) &amp;&amp; isAllowed($header);
    }

    public function isInbox($header)
    {
        return $header-&gt;to == $this-&gt;mailbox-&gt;address;
    }

    public function hasPin($header)
    {
        $pin = $this-&gt;getPin($header);
        return $pin !== false &amp;&amp; is_numeric($pin);
    }

    public function getPin($header)
    {
        return substr($header-&gt;subject, 0, 5));
    }

    public function isAllowed($header)
    {
        return call_user_func($this-&gt;pincall,
                              $this-&gt;mailbox-&gt;address,
                              $header-&gt;from,
                              $this-&gt;getPin());
    }
}


The calling code would then look like:    

foreach(new ValidHeaderIterator($headers, $mailbox, $pincall) as $header) {
    // do stuff
}