php string comparison considering spaces in between
<p>in php i need to compare 2 strings.</p>

<pre>str1="this is             a       string"</pre>

<pre>str2=" this is a string  "</pre>

<p>I want to consider str1 and str2 to be the same string.</p>

<p>The way I can think is:</p>

<p>trim the strings first. extract the words of each string first, compare the words and then get the result.</p>

<p>Any better way i.e. bulit-in function or something else to make the comparison?</p>
