php substr returning incorrect characters on a string variable from a preg_match function
<p>This is sort of a rookie question, but...</p>

<p>I'm calling a function in another php file that uses preg_match to get a string. I then want to use substr to get a specific part of that string, however it doesn't output any of the characters in the string. When I replace the variable from the <code>preg_match</code> function, I get the right output.</p>

<p>Here is the basic code:</p>

<pre><code>$title = $stream["song1"]; // From a preg_match in an external php file
echo $title; // Correctly prints the song name, in this case "mySong"
echo substr($title, 0, 1);  // Outputs a "&lt;" symbol (why??)
</code></pre>

<p>If I run the same three lines above, but hard code the song title:</p>

<pre><code>$title = "mySong";
echo $title; // Correctly prints the song name, in this case "mySong"
echo substr($title, 0, 1);  // Outputs a "m" symbol (correct)
</code></pre>

<p>Also, when I check the type of variable <code>$title</code> is, it returns "string".  I'm sure I'm doing something really stupid... can anyone help?</p>
