note 30389 added to function.explode

From: Date: Sun, 16 Mar 2003 15:04:16 +0000
Subject: note 30389 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-45389@lists.php.net to get a copy of this message
for easy reverse dns-lookups i use the following script: if (!isset($GLOBALS['HTTP_SERVER_VARS']['argv'][1])) die("usage: {$GLOBALS['HTTP_SERVER_VARS']['argv'][0]} ip-address\n"); $ip = $GLOBALS['HTTP_SERVER_VARS']['argv'][1]; $ar = explode('.',$ip); if (sizeof($ar) != 4) die("error: $ip not a valid ip\n"); $rip = implode('.',array_reverse ($ar)); passthru("nslookup -type=PTR $rip.in-addr.arpa."); or, the short way: passthru( "nslookup -type=PTR ".implode('.', array_reverse ( explode('.', $GLOBALS['HTTP_SERVER_VARS']['argv'][1]) )).".in-addr.arpa." ); -- http://www.php.net/manual/en/function.explode.php http://master.php.net/manage/user-notes.php?action=edit+30389 http://master.php.net/manage/user-notes.php?action=delete+30389 http://master.php.net/manage/user-notes.php?action=reject+30389

« previous php.notes (#45389) next »