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

Popular posts from this blog

c++ - Function signature as a function template parameter -

How to call a javascript function after the page loads with a chrome extension? -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -