php - str_get_html and simply html dom -


way after str_replace function $img empty , secont $img->find('img') function show error:

fatal error: cannot use object of type simple_html_dom array in d:\wamp\www\test.php on line 7     <?php require_once('simple_html_dom.php');  $img_html = str_get_html('hhtml tekst html tekst <img src = "img.png" /> ad sad');  foreach($img_html->find('img') $element)     $img[] = $element->src . '<br>';  $img_html = str_replace($img[0], 'n-'.$img[0], $img_html);      foreach($img_html->find('img') $element2)     echo $element2->src . '<br>'; ?> 

is you're aiming do?

foreach($img->find('img') $element)     $img[] = $element->src . '<br>'; 

$img object on first foreach -loop, you're trying access $img array, causing error. accidentally using same variable name 2 different things?


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -