7.50 Mathématiques
7 Index des fonctions
Manuel PHP
. Introduction . Pré-requis . Installation . Configuration à l'exécution . Types de ressources . Constantes prédefinies . 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
|
7.50.45 pow()Expression exponentielle[ Exemples avec pow ] PHP 3, PHP 4
number
pow (
number
base
,
number
exp
)
pow
retourne
base
élevé à la puissance
exp
.
Si possible,
pow
retourne un
integer
.
Si le calcul ne peut être fait, une alerte sera affichée et
pow
retournera
FALSE
.
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
et
sqrt
.
|