Fatal error: Cannot redeclare date_add() in
<?
function get_date() {
return date("Y-m-d H:i:s");
}
function date_add($dd) {
return date("Y-m-d H:i:s",mktime(date("H"), date("i"), date("s"), date("m"), date("d")+$dd, date("Y")));
}
function date_del($dd) {
return date("Y-m-d H:i:s",mktime(0, 0, 0, date("m"), date("d")-$dd, date("Y")));
}
?>
it shows me error at this file? can anyone help me?
The error message is quite descriptive: you're redeclaring a core function. The funciton exists, so you can't declare it again.
Whenever you encounter an error message like this, check www.php.net/<your-function-name>
, if you get a doc page about a function with that name, you know to change the function name, or better yet: use the existing function. Built in functions will almost certainly be faster.
There's a built-in function named date_add, you're not allowed to replace it with your own function.