Skip to Main Content
PHP 5 Kochbuch, Third Edition
book

PHP 5 Kochbuch, Third Edition

by David Sklar, Adam Trachtenberg, Carsten Lucke, Matthias Brusdeylins, Ulrich Speidel, Stephan Schmidt
September 2009
Intermediate to advanced content levelIntermediate to advanced
912 pages
48h 11m
German
O'Reilly Verlag
Content preview from PHP 5 Kochbuch, Third Edition

2.11 Trigonometrische Funktionen berechnen

Problem

Sie möchten trigonometrische Funktionen wie Sinus, Kosinus und Tangens verwenden.

Lösung

PHP unterstützt viele trigonometrische Funktionen von Hause aus: sin(), cos() und tan():

$cos = cos(2.1232);

Sie können auch deren Umkehrungen verwenden: asin(), acos()und atan():

$atan = atan(1.2);

Diskussion

Diese Funktionen gehen davon aus, dass ihre Argumente als Bogenmaß und nicht in Graden angegeben sind (siehe „2.12 Trigonometrische Funktionen mit Graden anstelle von Bogenmaßen berechnen“, falls dies ein Problem ist).

Die Funktion atan2() übernimmt die beiden Variablen $x und $y und errechnet atan($x/$y). Sie gibt jedoch immer das richtige Vorzeichen zurück, weil sie beide Parameter berücksichtigt, wenn sie ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP programmieren unter Windows

PHP programmieren unter Windows

Arno Hollosi
CSS Kochbuch, 3rd Edition

CSS Kochbuch, 3rd Edition

Joergen Lang, Christopher Schmitt

Publisher Resources

ISBN: 9783868993271Purchase book