0

How to resolve this problem ?

if (strpos($scripts->item($i)->nodeValue, "test") !== false) { //line 127
    return true       
}

Notice: Trying to get property of non-object on line 127

treyBake
  • 6,440
  • 6
  • 26
  • 57
  • The error is telling you that `$scripts->item($i)` is not an object. There is not enough information here to help us tell you why, but I suspect there aren't `$i` items in `$scripts`. – rickdenhaan May 31 '19 at 10:32

1 Answers1

0

Check if values exist at all

if(!empty($scripts->item($i)->nodeValue))
{
//your code
}
Sourabh Shah
  • 140
  • 2
  • 11