PHP pow() Function – Exponential Expression

The PHP pow() function returns the base raised to the exponent, optionally yielding an integer, and its usage is illustrated with examples showing integer, zero, negative, and floating‑point exponent cases, including version‑specific behavior for PHP 4.0.6 and later.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP pow() Function – Exponential Expression

The pow() function in PHP calculates the power of a base number raised to an exponent and returns the result, attempting to return an integer when possible.

Signature: number pow(number $base, number $exp) Parameters

$base – The base number.

$exp – The exponent.

Return value

The value of $base raised to the power of $exp. May be an integer if the result fits.

Examples

<?php
var_dump(pow(2, 8)); // int(256)

echo pow(-1, 20); // 1

echo pow(0, 0); // 1

echo pow(-1, 5.5); // PHP >4.0.6  NAN

echo pow(-1, 5.5); // PHP <=4.0.6 1.#IND
?>
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendPHPfunctionexampleexponentPoW
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.