Код: Выделить всё
$bulltin_name = $xpath->evaluate('//body/div/div/div/ul/li/a');
$bulltin_url = $xpath->evaluate('//body/div/div/div/ul/li/a/@href');
Код: Выделить всё
foreach($bulltin_name as $element)
{
$purified_bulletin_name = "";
$bulletin_name = $element->textContent;
for ($a = 0; $a < strlen($bulletin_name); $a++)
{
if (substr($bulletin_name, $a, 1) != " ")
{
$purified_bulletin_name .= substr($bulletin_name, $a, 1);
}
}
$bulletin_number = strval(mb_substr($purified_bulletin_name, 4, 3, 'UTF-8'));
print_r($bulletin_number .": " . $purified_bulletin_name . "
");
}
Код: Выделить всё
foreach($bulltin_url as $url)
{
$bulltins_url = $url->textContent;
print_r("https://www.info.gov.hk" .$bulltins_url. "
");
}
Я хочу выполнить такую операцию:
Код: Выделить всё
{
// A loop (for loop? or some other loop?)
// some operations here
// some operations here
// some operations here
print_r($bulletin_number .": " . $purified_bulletin_name . ", ". $bulltins_url . "
");
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... ion-in-php
Мобильная версия