pi
<<<
pow rad2deg
>>>

6.51 Mathématiques
6 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

6.51.45 pow()Puissance

[ 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);
  
// erreur
?>
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 .

<< pow >>
pi Mathématiques rad2deg