There is no PHP function you can use. If the "whois" program is installed, you could run that using popen() and read the results from it and parse them somehow (they're designed to be human-readable and in most cases the whois servers explicitly forbid automated queries - so be careful).
An alternative is to discover the whois protocol (which I'm sure is very simple) and implement it in PHP using fsockopen() etc.
Be careful and polite; I think you should rate-limit the speed you query domains with.
Mark