Jump to content

call a function from with in a function


denoteone

Recommended Posts

I am getting nothing to the screen with this page.

 

<?PHP
ini_set ("display_errors", "1");
error_reporting(E_ALL);

function  hello_test($text){
if ($text = 'hello'){
        echo $text;

}else{
      hello_test('hello');

}

hello_test('goodbye');

echo "not working";
?>

You never closed your function...  With proper indentation this could have been easily detected.

 

Try this:

 

ini_set("display_errors", "1");
error_reporting(E_ALL);

function  hello_test($text){
   if ($text == 'hello'){
      echo $text;
   } else {
      hello_test('hello');
   }
}

hello_test('goodbye');

?>

 

EDIT: You know this will always echo "hello", right?

thanks I will pay  more attention to the indentation.

 

yes I know. I am jsut try to test something. I hav an issue with my other script that calls a funtion with in a function. I am not getting any errors but I am not seeing the result I want.

 


if (strpos($fp,"Redirected")){
  									
                       if(strpos($fp,"whois.ripe.net")){

		$whois_ip_servernew = 'whois.ripe.net';
               		 whois_ip($whois_ip_servernew, '-1', 'FALSE', $visitor_ip);
              								 
                       }else{
		return $fp;
                       }
             
  }else{
  return $fp; 
  }

Same problem as before...

 

Try:

 

if (strpos($fp,"Redirected")){
   if(strpos($fp,"whois.ripe.net")){
      $whois_ip_servernew = 'whois.ripe.net';
      whois_ip($whois_ip_servernew, '-1', 'FALSE', $visitor_ip);                                
   } else {
      return $fp;       
   } 
} else {
   return $fp;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.