次の形式の3つの配列があります。
Array (
[0] => NAME
[1] => NAME
[n] => n
)
Array (
[0] => DATE
[1] => DATE
[n] => n
)
Array (
[0] => TEXT
[1] => TEXT
[n] => n
)
次の種の1つでこれらの3つのアレイを可能な限り組み合わせることができますか?
Array(
Array (
[0] => NAME
[1] => DATE
[2] => TEXT
)
Array (
[0] => NAME
[1] => DATE
[2] => TEXT
)
Array (
[0] => NAME
[1] => DATE
[2] => TEXT
)
and etc.
)
配列は、ライブラリPHP SimpleHTMLDOMパーサーマニュアル を使用して構築されます。
// Search for the name
$array_nameNews = array();
foreach($html->find('div.narrow_column div h2 a') as $element) {
$nameNews = $element->innertext;
$array_nameNews[] = $nameNews;
}
// Search the date
$array_dateNews = array();
foreach($html->find('div.narrow_column div div.postdate') as $element) {
$dateNews = $element->innertext;
$array_dateNews[] = $dateNews;
}
// Search text
$array_textNews = array();
foreach($html->find('div.narrow_column div div.postdate span') as $element) {
$textNews = $element->innertext;
$array_textNews[] = $textNews;
}