Skip to content
Advertisement

How to Split the nodevalues on php dom element

i scrape the website, i am getting result of below in single element, i want to split the one by one element.

code:

JavaScript

input:-

JavaScript

Current output:-

JavaScript

expecting output:-

JavaScript

Advertisement

Answer

Each of the text parts is a part of the <div> tag, so this code just assumes that you want the text from each direct child not and adds it to an array in the loop using []

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement