str_replace
PHPについて質問です。私がする時:
$latdir = $latrichting.$Lat;
If (preg_match("/N /", $latdir)) {
$Latcoorl = str_replace(" N ", "+",$latdir);
}
else {
$Latcoorl = str_replace ("S ", "-",$latdir);
}
print_r($latdir);
print_r($Latcoorl);
print_r($latdir);
与える:N52.2702777778
しかし、print_r ($Latcoorl);
与える:N52.270277777800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
はい、それは多くのゼロを追加します。楽しみのためだけに、誰かがこの振る舞いを説明できますか?
print_r ($latrichting);
与える:N
print_r ($Lat);
これは奇妙な長い数字です。
おそらく str_replace コマンドではないと思いますか?