Why does this PHP function return the wrong result?
<p>I wrote a user function to return the distance between two points on an x,y coordinate system.  The input params were <code>0,0,10,10</code>.</p>

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

<pre><code>public static function dist2d($x1,$y1,$x2,$y2) {
   return sqrt((($x2 - $x1) * ($x2 - $x1)) + (($y2 - $y1) * ($y2 - $y1)));
}
</code></pre>

<p>This returns 110.</p>

<p>Here is the code that works:</p>

<pre><code>public static function dist2d($x1,$y1,$x2,$y2) {
    $result = (($x2 - $x1) * ($x2 - $x1)) + (($y2 - $y1) * ($y2 - $y1));
    return sqrt($result);
}
</code></pre>

<p>This returns <code>14.1</code>.</p>

<p>I am new to PHP, what is going on here?</p>
