gethostbyaddr
does a reverse DNS lookup. It does not contact the host directly. However, it may contact DNS servers to do the reverse lookup.
Typically PHP will ask the system's DNS service for the reverse lookup, and if the answer doesn't happen to be cached, the service will contact its closest DNS server to get the answer. If that doesn't have the answer, it will go out and contact its closest upstream server etc. etc. until the answer comes back.
So, rarely if ever should the server reach out further than its closest DNS server. It's certainly not impossible though, and if your server happens to contact a DNS server which your user happens to have control over, that user could see the incoming DNS resolution request.
That will be extremely rare, and again, typically the only DNS server your server will have contact with is its closest DNS server, but cannot be entirely ruled out.