Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to find if an element has a certain child or not? #42

Open
ghost opened this issue May 4, 2017 · 0 comments
Open

Is there any way to find if an element has a certain child or not? #42

ghost opened this issue May 4, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented May 4, 2017

So, the page that I am parsing. It has a td tag within that in some cases it has a tag and in some cases it doesn't have.
However, i have tried this $row->find('td', 2)->find('a', 0) and it says can't find value on null.
Is there anyway to find the child exists or not?

One way that I have found is count($row->find('td', 2)->find('a', 0)) and if it returns 1 basically there's a child and otherwise none.
Is there any other way to find it?
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants