PHP variables not equal
<p>I am still relatively new to coding with PHP, though I am familiar with a few other languages, so I decided to fool around with it a bit.</p>

<p>Basically I have been playing with regex and Web scraping, and am working on a script to parse some information from a site.  I am getting the information fine, but when I try to compare the values in one of my arrays to a string, it is not coming up equal even though the values show the same and are the same data type.  Here is an example of what I am working with.  </p>

<p>Here I am simply trying to get my values compared by retrieving a set of values from a site and then moving them to a 1d array.  Assuming that the value of array[0] = "Value", it should be equal to $str.  I have checked with gettype() and both $tmp and $str are strings, yet they do not register as equal.  I have also tried with current() values in my array (which would actually be better for my purposes) but it is the same.</p>

<p>What I actually need to do is locate a value in my array and compare it to $str.  If it matches, I need to set a variable to the previous value in the array. </p>

<pre><code>$html = file_get_contents("http://www.site.com");    
$str = "Value";

preg_match_all ('/&lt;td class=\"name\"&gt;(.*?)&lt;\/td&gt;/s', $html, $return, PREG_PATTERN_ORDER);

           for ($ii = 0; $ii &lt; count($return[0]); $ii++) {
                 $array[$ii] = $return[0][$ii];
           }


            $tmp = $array[0];

            if ($tmp == $str) {
              echo "yes";
            }
</code></pre>
