Mass Convert IP Addresses to Domain Names with a Filter

A PHP script to convert many IP addresses to domain names. You can paste text with addresses and it'll convert them.
<?php

if ($_POST['text']) {
        $t = $_POST['text'];
        $o = preg_replace('/(\\d+\\.\\d+\\.\\d+\\.\\d+)/e', 'get_host(\'\\1\')', $t);
        # $o = preg_replace('/(\\d+\\.\\d+\\.\\d+\\.\\d+)/e', 'gethostbyaddr(\'\\1\')', $t);
        echo '<pre>'.$o.'</pre>';
}

function get_host($ip){
        $ptr= implode(".",array_reverse(explode(".",$ip))).".in-addr.arpa";
        $host = dns_get_record($ptr,DNS_PTR);
        if ($host == null) return $ip;
        else return $host[0]['target'];
}

?><html>
<body>
<p>This script takes text with embedded IP addresses as input, and converts the addresses
to domain names.</p>
<form method="post">
<textarea name="text" rows="10" cols="80">
</textarea>
<br />
<input type="submit" />
</form>
</body>
</html>