how to find number of similar words in two strings?
<p>I have two stings:</p>

<pre><code>$var_x = "Depending structure";
$var_y = “Depending on the structure of your array ";
</code></pre>

<p>Can you please tell me how can I found out, how many words in var_x is in var_y?
In order to do that, I did the following:</p>

<pre><code>$pieces1 = explode(" ", $var_x);
$pieces2 = explode(" ", $var_y);
$result=array_intersect($pieces1, $pieces2);
//Print result here?
</code></pre>

<p>But this didn't show many how many of var_x words are in var_y</p>
