PHP function 到底有什么好处? 可以自动清除数组,清除变量,清除MEMORY吗?$array = array('http://www.google.com.hk','http://www.baidu.com','http://www.1.com/','http://www.yahoo.com.cn');
foreach($array as $url){
    $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)');
$html = curl_exec($ch);
curl_close($ch);
echo $html.'<hr />';
$html = NULL;
        unset($html);
}
function get_html($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)');
$html = curl_exec($ch);
curl_close($ch);
return $html;
}
$array = array('http://www.google.com.hk','http://www.baidu.com','http://www.1.com/','http://www.yahoo.com.cn');
foreach($array as $url){
    get_html($url);
}
如果是function的话,是否也要unset数组?
还是只要return,下次执行function时会自动清空第一次执行function时的数组?