You can try something like this...

<? php
.
.
.
$i = 0;
while($table[$i]) {
    if(preg_match('/@/', $table[$i]) {
        // do email process 

    } else if (preg_match('/http:\/\//', $table[$i]) {
        // do url process

    } else {
        throw new exception ('Unrecognized table entry');
    }
    $i++;
}