PHP返回NAN

时间:2018-09-04 11:35:26

标签: php nan

我写了这段代码,我不知道为什么它返回NAN

<?PHP cordsdist($_POST['1x'], $_POST['1y'], $_POST['1z'],
 $_POST['2x'], $_POST['2y'], $_POST['2z']);
         function cordsdist ($x1, $y1, $z1, $x2, $y2, $z2) {
             $v1 = $x1 - $x2 * 2;
             $v2 = $y1 - $y2 * 2;
             $v3 = $z1 - $z2 * 2;
             $dist = sqrt($v1 + $v2 + $v3); 
             echo $dist;
             //               [   v1    ]  [  v2     ]  [    v3   ]
             // Distance = √[ (x1 − x2)2 + (y1 − y2)2 + (z1 − z2)2 ] 
         } ?>

0 个答案:

没有答案