How to find the power of a number in php

青灯夜游
Release: 2023-03-15 15:32:01
Original
4254 people have browsed it

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".

How to find the power of a number in php

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:

How to find the power of a number in php

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);
?>
Copy after login

How to find the power of a number in php

##2. Use the operator (**) Calculate the Nth power of a number

<?php
$i=2;
$n=8;
echo $i**$n;  //打印结果:256
?>
Copy after login

How to find the power of a number in php

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template