Код: Выделить всё
$html = str_get_html('HelloWorld');
$html->find('div[class=hello]', 0)->innertext = 'foo';
echo $html; // Output: fooWorld
Что следует заменить 0?
Подробнее здесь: https://stackoverflow.com/questions/479 ... dom-parser
Код: Выделить всё
$html = str_get_html('HelloWorld');
$html->find('div[class=hello]', 0)->innertext = 'foo';
echo $html; // Output: fooWorld