Skip to content

PHP Scientific Notation

Syntax

Scientific notation in PHP is used to represent very large or small numbers using the format aEn, where a is the mantissa and n is the exponent.

// Declaring numbers in scientific notation
$largeNumber = 1.2e3; // Equivalent to 1.2 * 10^3 = 1200
$largeNumber = 1.2E3; // Equivalent to 1.2 * 10^3 = 1200
$smallNumber = 1.2e-2; // Equivalent to 1.2 * 10^-2 = 0.012
$smallNumber = 1.2E-2; // Equivalent to 1.2 * 10^-2 = 0.012