Rechenfehler von PHP ?????

birthdefect
Ich habe ein kleines Programm, das sich verrechnet.
Seht selbst. verwirrt

Ich finde einfach keinen Fehler an der Programmierung. Mauer

rechenfehler.php

Hier die Ausgabe des Skriptes:
Zitat:

Rechenfehler in php?
Hier das PHP-Programm:

$xyinformation[0] = 0;
$xyinformation[1] = 0;
$xyinformation[2] = 12.001; // links oben, Longitude E
$xyinformation[3] = 48.201; // links oben, Latitude N
$xyinformation[4] = 14.101; // rechts unten, Longitude E
$xyinformation[5] = 46.801; // rechts unten, Latitude N
$xyinformation[0] = ($xyinformation[4]-$xyinformation[2]); // breite sollte sich aus den Bundeslandgrenzen ergeben
$xyinformation[1] = ($xyinformation[3]-$xyinformation[4]); // hoehe sollte sich aus den Bundeslandgrenzen ergeben

echo "xyinformation[0] = ".$xyinformation[0]."\n";
echo "xyinformation[1] = ".$xyinformation[1]." --- HIER IST EIN FEHLER! Wieso?\n";
echo "xyinformation[2] = ".$xyinformation[2]."\n";
echo "xyinformation[3] = ".$xyinformation[3]."\n";
echo "xyinformation[4] = ".$xyinformation[4]."\n";
echo "xyinformation[5] = ".$xyinformation[5]."\n";
echo "xyinformation[4]-xyinformation[2] = ".($xyinformation[4]-$xyinformation[2])."\n";
echo "xyinformation[3]-xyinformation[5] = ".($xyinformation[3]-$xyinformation[4])."\n";
echo "48.2-46.8 = ".(48.200-46.800)."\n";
echo "xyinformation[3] x 10 =".($xyinformation[3]*10)."\n";
echo "xyinformation[5] x 10 =".($xyinformation[5]*10)."\n";
echo "xyinformation[3] x 10 - xyinformation[5] x 10 = ".(($xyinformation[3]*10)-($xyinformation[5]*10))."\n";


Hier die Ausgabe:
xyinformation[0] = 2.1
xyinformation[1] = 34.1 --- HIER IST EIN FEHLER! Wieso?
xyinformation[2] = 12.001
xyinformation[3] = 48.201
xyinformation[4] = 14.101
xyinformation[5] = 46.801
xyinformation[4]-xyinformation[2] = 2.1
xyinformation[3]-xyinformation[5] = 34.1
48.2-46.8 = 1.4
xyinformation[3] x 10 =482.01
xyinformation[5] x 10 =468.01
xyinformation[3] x 10 - xyinformation[5] x 10 = 14

Ende.


Weiß von Euch einer mehr darüber ? geschockt

Liegt es an PHP ? Mauer

PS:
Ich habe es auf einem Xampp unter Windows probiert,
aber selbst auf dem Server meiner Homepage erscheint
der Fehler.
ThiefMaster
Was ist daran bitte falsch?
48.201 - 14.101 = 34.1
birthdefect
Verflucht!

Ich bin eine Stunde davor gesessen und habe den
Indexfehler MEINERSEITS nicht gesehen.

Meine neue Frage lautet:
Bin ich krank?
Bin ich Codeblind ?

Mauer

großes Grinsen Danke Thiefmaster, jetzt seh ichs auch !!!

Sorry wegen diesem Beispiel an Flüchtigkeitsfehler.
PS.: Ganz schön schnel reagiert ;o)
Chris Hunter
Zitat:
Original von birthdefect

Meine neue Frage lautet:
Bin ich krank?
Bin ich Codeblind ?


Du bist überarbeitet ;-)