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]function grabStatus($server, $portn) {
$ip = “$server”;
$port = “$portn”;
echo “Server:”;
if (! $sock = @fsockopen($ip, $port, $num, $error, 5)) {
echo “Online”;
} else {
echo “Offline”;
}
}
grabStatus(/* a server ip */, 8023); //randomly picked port that is not being utilized
[/php]
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.