pow
Name
pow — Raises the first argument to the power of the
second argument.
Synopsis
float pow
(number, power);
float number: Number to be
raised
float power: Power to which
to raise the number
Returns
Result of raising one number to the power of another
Description
This function raises number to
the power of power . For
example, to raise 3 to the power of 2,
the notation is pow(3, 2)() . See
the example for pi()
to see how this function applies when calculating the
area of a circle.
Example
Example 687. Use pow() to
calculate a hypotenuse
$hyp = 5;
$adj = 4;
$opp = 3;
$hyp_calc = pow($opp, 2) + pow($adj, 2);
$hyp_true = pow($hyp, 2);
echo "a squared + b squared = $hyp_calc<BR />\n";
echo "c squared = $hyp_true\n";
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from
http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.