Home >Backend Development >PHP Problem >How to find the power of a number in php
How to find the power of a number: 1. Use the built-in function pow() to calculate the Nth power of a number. The syntax is "pow (value, power)"; 2. Use "**" Operator to calculate the Nth power of a number, the syntax is "numeric ** power".
The operating environment of this tutorial: windows7 system, PHP7.2 version, DELL G3 computer
How to find a php Counting to several powers
For example:
The following two methods are introduced:
1 , Use the built-in function pow() to calculate the Nth power of a number
<?php $i=2; $n=8; echo pow($i,$n); ?>
##2. Use the operator (**) Calculate the Nth power of a number
<?php $i=2; $n=8; echo $i**$n; //打印结果:256 ?>Recommended learning: "
PHP Video Tutorial"
The above is the detailed content of How to find the power of a number in php. For more information, please follow other related articles on the PHP Chinese website!