I am killing myself here, i've managed to create a WhoIs function for a website to see if it is registered or not. It works great, but I need to use that information in three diferent places. Is it possible to access the variable content that the function generates outside the function? Let me give you an example, this is the function: <?php global $domain_status; function whois ($server, $query){ //The function does is thing and gives the results... if (eregi($available,$result)) {$domain_status = "available";} else {$domain_status = "notavailable";} } ?> PHP: I call the function in some place of my page with whois($server, $query) and if the domain is available the $domain_status will give available and so on... Now if in somewere of my page I add this code: <?php echo($domain_status); ?> PHP: It will give me nothing, blank! Can someone please help me on this? I need the result of that function available in 3 diferent places and I can't run the function 3 times.
Oh, silly me... I've solved it... I've just needed to add $GLOBALS['domain_status'] and it works... Maybe this will be useful for someone else. Thanks anyway guys!
You should have the global statement inside the function... <?php function whois ($server, $query) { global $domain_status; //The function does is thing and gives the results... if (eregi($available,$result)) { $domain_status = "available"; } else { $domain_status = "notavailable"; } } ?> PHP: