Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - TheRoyalNoob

Pages: [1]
1
Beginners - Learning PHP / Function not working correctly
« on: May 04, 2012, 11:45:11 PM »
Now I usually don't use functions but I am just trying them out.

Now what I am trying to do is make it easy to execute the function using the defined values but it always returns as online regardless of the value I use.

PHP Code: [Select]
function grabStatus($server$portn) {
$ip "$server";
$port "$portn";
echo 
"Server:";
if (! 
$sock = @fsockopen($ip$port$num$error5)) {
	
echo 
"Online";
	
} else {
	
echo 
"Offline";
	
}
}

grabStatus(/* a server ip */8023); //randomly picked port that is not being utilized 


I'd appreciate help. I do understand how functions work to an extent, I just don't know why this isn't working for me.

2
It looks like you may want to disable "display_errors" to off in your PHP ini file. The below may be displayed because it is set to YES.

Warning: preg_match() [function.preg-match]: Empty regular expression in /home/content/82/9307982/html/contact.php on line 77

Warning: preg_match() [function.preg-match]: Empty regular expression in /home/content/82/9307982/html/contact.php on line 77

Pages: [1]