Fatal error: Unsupported operand types in G:\xampp\htdocs\pattern.php on line 14
<p>I keep getting the following error and I was wondering on how to fix?</p>

<p>This is the second time I got this error I fixed it the first time but for some reason I cant fix it the second time.</p>

<pre><code>Fatal error: Unsupported operand types on line 14
</code></pre>

<p>Here is line 14</p>

<pre><code>$sub=$a-$b;
</code></pre>

<p>Here is the full code below.</p>

<pre><code>&lt;?php



$x=array(2,10);
$y=array(3,5);
$z=D($x,$y);

echo ('sum is :'.$z);

/** compute Euclidean distance http://en.wikipedia.org/wiki/Euclidean_distance */
 function D ($a,  $b)
{
    $sub=$a-$b;
    return pow($sub,2);
}
function distance_betwen($p,$q)
{
    $nu_argu=func_num_args();
    if( $nu_argu!=2)
    {
        echo 'please enter a valid 2 coordinates like this (1,2)';
    }
    else if (sizeof($p)!=sizeof($q))
    {
        echo 'values of each pair must have the same dimention';
    }
    else
    {
        $c=array_map("D",$p,$q);
        return pow(array_sum($c),0.5);
    }
}

?&gt;
</code></pre>
