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.

Topics - 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.

Pages: [1]