denoteone Posted April 8, 2009 Share Posted April 8, 2009 can you call a function with different parameters from that same function? example: function hello_test($text){ if ($text == "hello"){ echo $text; }else{ hello_test('hello'); } hello_test('goodbye'); Link to comment https://forums.phpfreaks.com/topic/153219-call-a-function-from-with-in-a-function/ Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 can you call a function with different parameters from that same function? What gives you doubt, have you tried? Link to comment https://forums.phpfreaks.com/topic/153219-call-a-function-from-with-in-a-function/#findComment-804876 Share on other sites More sharing options...
denoteone Posted April 8, 2009 Author Share Posted April 8, 2009 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"; ?> Link to comment https://forums.phpfreaks.com/topic/153219-call-a-function-from-with-in-a-function/#findComment-804879 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 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? Link to comment https://forums.phpfreaks.com/topic/153219-call-a-function-from-with-in-a-function/#findComment-804882 Share on other sites More sharing options...
denoteone Posted April 8, 2009 Author Share Posted April 8, 2009 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; } Link to comment https://forums.phpfreaks.com/topic/153219-call-a-function-from-with-in-a-function/#findComment-804892 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 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; } Link to comment https://forums.phpfreaks.com/topic/153219-call-a-function-from-with-in-a-function/#findComment-804905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.