pi
<<<
pow rad2deg
>>>

8.61 Mathématiques
8 Référence des fonctions
 Manuel PHP

Introduction
Pré-requis
Installation
Configuration à l'exécution
Types de ressources
Constantes pré-définies
abs
acos
acosh
asin
asinh
atan
atan2
atanh
base_convert
bindec
ceil
cos
cosh
decbin
dechex
decoct
deg2rad
exp
expm1
floor
fmod
getrandmax
hexdec
hypot
is_finite
is_infinite
is_nan
lcg_value
log
log10
log1p
max
min
mt_getrandmax
mt_rand
mt_srand
octdec
pi
->pow
rad2deg
rand
round
sin
sinh
sqrt
srand
tan
tanh

8.61.45 pow()Expression exponentielle

[ Exemples avec pow ]   PHP 3, PHP 4 , PHP 5

number  pow ( number   base , number   exp )

pow retourne base élevé à la puissance exp . Si possible, pow retourne un entier .

Si le calcul ne peut être fait, une alerte sera affichée et pow retournera FALSE . Depuis PHP 4.2.0, pow n'affiche plus aucun warning.

Note

PHP ne peut pas gérer une valeur négative de base .

Quelques exemples avec pow

<?php

var_dump
(pow(2, 8) ); // int(256)
echo pow(-1, 20); // 1
echo pow(0, 0); // 1

echo pow(-1, 5.5); // error

?>
Attention

En PHP 4.0.6 plus ancien, pow retournait toujours un nombre à virgule flottante ( float ), et n'affichait pas d'alerte. Si le calcul est impossible (racine d'un nombre négatif, par exemple), pow retournait NAN .

Voir aussi exp , sqrt , bcpow et gmp_pow .

<< pow >>
pi Mathématiques rad2deg