I am trying to use an IF statement to check if a variable contains a piece of text, if so, echo yes, if not, echo no. Simple I know, but it does not seem to be working for me. I am very new to PHP, so any replies should be understandable for a monkey! :P
Here is my code. Bear in mind I am working with PHP simple html dom.
<?php
include 'simple_html_dom.php';
$html = file_get_html('http://www.amazon.co.uk/New-Apple-iPod-touch-Generation/dp/B0040GIZTI/ref=br_lf_m_1000333483_1_1_img?ie=UTF8&s=electronics&pf_rd_p=229345967&pf_rd_s=center-3&pf_rd_t=1401&pf_rd_i=1000333483&pf_rd_m=A3P5ROKL5A1OLE&pf_rd_r=1ZW9HJW2KN2C2MTRJH60');
$stock_data = $html->find('span[class=availGreen]',0);
if ( $stock_data == "In stock." ) {
echo "Yes";
}
echo "No";
?>
Now I have tested if the variable did contain the text, using echo $stock_data; it prints the correct text, however the if statement still comes back and echo's No.
Any help, apologies if this is something so simple.