note 3434 deleted from gethostbyaddr by ronabop

From: Date: Fri, 11 Aug 2000 16:23:22 +0000
Subject: note 3434 deleted from gethostbyaddr by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-1288@lists.php.net to get a copy of this message
Newbie alert, newbie alert!!! ok. In sh one can get the return status of an executed command using $?. Is there an equiv in PHP? Why? Well, I understand that the return code of gethostbyaddr() is the value of the hostname of the addr (if the function succeeded) and the IP addr if it didn't. This is all dandy but I want to discern between whether it succeeded or not. <br> I even confused myself on that...let me give the code I am playing with:<br> //$r_host = $REMOTE_ADDR; $r_host = "xxx.xxx.xxx.xxx"; //a non PTR mapped IP we have. $r_hostname = gethostbyaddr($r_host); // $counter++; // SetCookie ("counter", "$counter", time()+3600); if ( ereg("not done yet", $r_hostname) ) { //I haven't quite gotten this regex to work the way I want it to yet. So I left it out for purposes of this note addition printf("Return Status: error. Could not resolve address -> $r_host<br>n"); } else { printf("Return Status: good. Resolved address -> $r_host<br>n"); } <br> Ok. So see the regex above? That is the reason I am asking this question. See...if I could simply get a return status of the just-executed function I could do something similar to: if ( $return_status == 0 ) { etc etc }. <br>Any thoughts?

« previous php.notes (#1288) next »