How can PHP be used to calculate exponents with a variable base and exponent?

To calculate exponents with a variable base and exponent in PHP, you can use the `pow()` function. This function takes two arguments: the base and the exponent, and returns the result of raising the base to the power of the exponent.

$base = 2;
$exponent = 3;

$result = pow($base, $exponent);

echo "$base raised to the power of $exponent is: $result";