I am trying to confirm if a particular
Below is an example of the HTML:
<div class="mgrRspnInline"> <div class="header"> David, Manager at The Pub, responded to this review </div> <p class="partial_entry"> <span id="response_232376288"> Thank you for taking the time to write a review and post feedback. We appreciate your comments, hope that you continue to visit us and be satisfied every time. Looking forward to seeing you again soon </span>
And below is the code I am using:
$ret = $html->getElementByTagName('span');
//print_r($ret);
foreach($review_id as $value){
if($ret->find($value)){
echo "Yes";
} else {
echo "No";
}
}
$review_id is a list of review IDs in an array I.E - response_232376288
, all I want the code to do at this point is echo Yes
if it finds response_232376288
and no if it does not, but all I am getting is No's.
If anyone can assist?
Let's clean @ghost's answer up a bit. The answer is as simple as:
echo $html->find('#response_232376288', 0) ? 'Yes' : 'No';
There's really no need to clutter such a simple answer up with a bunch of extra baloney *(unless you happen to care for extra baloney I suppose)