Backend Development 2 min read

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
?>
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

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