Example 1 — Calculate powers of e
Find e to a few simple powers.
<?php
echo round(exp(1), 4) . PHP_EOL;
echo exp(0) . PHP_EOL;
echo round(exp(2), 4) . PHP_EOL; How It Works
- exp(1) is e to the power 1, so it equals e (2.71828...).
- exp(0) is e to the power 0, which is always 1.
- exp(2) is e x e, which is about 7.3891.
- round(..., 4) keeps the printed numbers short.

