php - Would this shorthand work within a function for the return? -
would below work? i'm not able test it, , wondering (as use little shorthand coding techniques) if you're able use shorthand return within function? can't think of reason why not work, couldn't find online verify.
function isonline($ip, $port, $timeout = 1) { return (($fp = fsockopen($ip, $port, $i, $j, $timeout)) ? fclose($fp) : false); }
the fclose()
function should return true, primary return true, correct?
of course can accomplish proper way, learning new ways things.
Comments
Post a Comment