PHP CURL HTTP status code of a URL read from

The reading of the status is simply using the following code from the header:

function getUrlSatusCode($url, $timeout = 10)
 $ch = curl_init();
 $opts = array(CURLOPT_RETURNTRANSFER => true, // do not output to browser
 CURLOPT_URL => $url, 
 CURLOPT_NOBODY => true, // do a HEAD request only
 CURLOPT_TIMEOUT => $timeout); 
 curl_setopt_array($ch, $opts);
 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
 return $status;