Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write the calculation formula of power in php

Shulou Source: shulou.com Published: 2022-06-01 03:20:19 11月08日 Update

This article mainly explains "how to write the calculation formula of power in php". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how to write the calculation formula of several powers in php.

The formula for calculating the power in PHP is "$x=pow (base, index);", and the value of the variable x is the result of the power calculation. The pow () function calculates and returns the result of the specified number to the specified power, the first parameter specifies the bottom of the exponential expression, the second parameter specifies the power of the exponential expression, and if it cannot be calculated, the result returned is NAN.

This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer.

The calculation Formula of several Power in php

The calculation formula is as follows:

$x=pow (base, index)

Function: the function of the pow () function is to calculate a number to the nth power and return it.

Syntax:

Pow (XQuery Y)

Parameters:

X represents the number to be processed

Y represents the n value in the specified n power.

Description: returns the Y power of X. if the parameter is correct, the function will return a numeric value. If it cannot be calculated, it will return NAN.

Examples are as follows:

Output result:

At this point, I believe you have a deeper understanding of "how to write the calculation formula of power in php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Formula parameter index result function function content base numerical value expression learning practical deeper number interest variable practicality practicality that is easy to operate. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information NVidia Huawei MySQL