Thursday, 16 August 2018

Error: Fatal error: Cannot redeclare exp() in PHP

Error: Fatal error: Cannot redeclare exp() in 

The message says Cannot redeclare and that means that the function already exists.
exp() is a built-in function in php.


You can do it like this
function my_exp($value1,$value2) {
  return $value1 ** $value2;
}
echo my_exp(2,8);//prints 256;
Or you can use the built-in function pow()
echo pow(2,8);//prints 256

No comments:

Post a Comment