Hey I have a problem with Simple DOM parser which is driving me nuts.
This works OK:
foreach($html->find('input[name=sex]') as $e)
echo $e->value;
Even if its only 1 result.
However this doesn’t work:
echo $html->find('input[name=sex]')->value;
I don’t want really use foreach because I expect only 1 result.
So someone could help me with second block of code?
Cheers
According to the docs, the second parameter is the index you wish to find. Set that to 0 to return the first (0th) element rather than an array of objects: