You want to raise a number to a power.
Use the following functions:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"> <head> <title>Exponents</title> <meta Name="Author" Content="Hann So"> </head> <body> <p> <?php $num = 2; echo "exp($num): ", exp($num), "<br />"; // raise e to a power echo "pow(2, 10): ", pow(2, 10), "<br />"; // raise to any power echo "pow(2, -2): ", pow(2, -2), "<br />"; echo "pow(-2, -2.5): ", pow(-2, -2.5), "<br />"; // NAN (error: Not a Number) ?> </p> </body> </html> |