HTML 테이블을 배열로 "HTML Table to Array" for PHP
	
	
	function HTMLTable2Array($file)
{
	if(!is_file($file)){return array();}
	// DOM 기반 HTML 처리
	
	$contents=file_get_contents($file);
	$contents=str_replace("\r",'',$contents);
    $DOM = new DOMDocument;
    $DOM->loadHTML($contents);
	// 사용변수 초기화
	$array_table=array();
	$count_table=0;
	$count_tr=0;
	$count_td=0;
	// 테이블을 가져오고 존재하지 않으면 중단.
	$tables=$DOM->getElementsByTagName('table');
	if($tables->length<1){return array();}
	
	foreach($tables as $table)	
	{
		// TBODY 가 섞여 있을수 있으므로 TR태그만 가져온다.
	    $trs=$table->getElementsByTagName('tr');
	    $count_tr=0;
	    foreach($trs as $tds)
	    {
		    // 필요하다면 nodeName 을 체크한다.
		    if($tds->nodeName!='tr'){continue;}
		    
		    // TR 하위 노드는 TD/TH 가 있으므로 childNodes 로 넘긴다.
	        $count_td=0;
		    foreach ($tds->childNodes as $td)
		    {
			    // td 태그 사이에 text 가 존재할수 있다. 노드이름을 구분하여 TD,TH만 가져오도록함.
				if($td->nodeName=='td' || $td->nodeName=='th')
				{
			        $array_table[$count_table][$count_tr][$count_td]=$td->nodeValue;
					$count_td++;
				}
		    }
		    $count_tr++;
	    }
	}
	return $array_table;
}