Bifalgorithm post · Computer science one · PHP Tags

How can PHP libraries and math functions be used?

How can PHP libraries and math functions be used? (Computer science one · PHP Tags) — "PHP has many built-in functions that you can use. These standard librari…

Ideas in this flowchart

  • PHP bietet viele integrierte Funktionen, die direkt verwendet werden können.
  • Die Standardbibliotheken sind ohne spezielle Import- oder Include-Anweisung geladen.
  • Das PHP-Handbuch dokumentiert jede Funktion online unter php.net.
  • Kommentare von PHP-Entwicklern ergänzen die Dokumentation mit Erklärungen, Tipps, Vorschlägen und Beispielcode.
  • Im weiteren Verlauf werden zahlreiche nützliche Funktionen vorgestellt.
  • Die Mathematikbibliothek ist eine besonders nützliche Funktionssammlung.
  • Sie ist direkt von der standardmäßigen C-Mathematikbibliothek übernommen, daher sind die Funktionsnamen identisch.
  • Sie stellt gängige mathematische Funktionen wie Quadratwurzel und natürlichen Logarithmus bereit.
  • Funktionen werden aufgerufen, indem man Eingaben übergibt und die zurückgegebene Ausgabe einer Variablen zuweist.
  • $x = 1.5$ initialisiert den Eingabewert.
  • $y = sqrt($x)$ berechnet die Quadratwurzel von 1.5 und weist sie $y$ zu.
  • $z = sin($x)$ berechnet den Sinus von 1.5 und weist ihn $z$ zu.
Feed/

How can PHP libraries and math functions be used?

No cover

Channel

Computer science one

1 page

"PHP has many built-in functions that you can use. These standard libraries are loaded and available to use without any special command to import or include them. Full documentation on each of these functions is maintained in the PHP manual, available online at http://php.net/. The manual’s web pages also contain many curated comments from PHP developers which contain further explanations, tips & tricks, suggestions, and sample code to provide further assistance. There are many useful functions that we’ll mention as we progress through each topic. One especially useful collection of functions is the math library. This library is directly adapted from C’s standard math library so all the function names are the same. It provides many common mathematical functions such as the square root and natural logarithm. Table 37.1 highlights several of these functions; full documentation can be found in the PHP manual (http://php.net/manual/en/ref.math.php). To use these, you simply “call” them by providing input and assigning the output to a variable.\n\n1 $x = 1.5;\n\n2 $y = sqrt($x); //y now has the value √ x = √ 1 . 5\n\n3 $z = sin($x); //z now has the value sin ( x ) = sin (1 . 5)\n\nIn both of the function calls above, the value of the variable $x is “passed” to the math function which computes and “returns” the result which then gets assigned to another variable."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.