You could almost certainly put it together with some suitable calls to strstr(), substr() and/or strpos().
I don't recall instr()'s exact behaviour right now, so I'm not going to confuse you by bothering to try.
But it sounds like a preg_match_all() regexp might get the bits you want faster.
preg_match_all('/<a[^>]+href="([^"]+)"[^>]*>/is',$html,$matches);
loosely speaking.