Entry
why can appear fatal error: cannot redeclare functinon_name in file_name ..
Apr 5th, 2001 07:27
Andrew Threlfall, Philip Olson, Alex Bogdanov,
You are redeclaring a function. Most likely it's being included twice
via an include file, this cannot be done. Essentially, this is
happening :
function foo()
{
print 'foo';
}
function foo()
{
print 'foo';
}
The second declaration of foo() will provide such an error. Have a
look around the code and locate the problem. Consider putting the
functions in one include, such as functions.php and include it. Once.
A somewhat new function (4.0.2+) is called include_once , it can be
read about here :
http://www.php.net/manual/en/function.include-once.php
It's also an option but ideally, the code structure will be optimized
as opposed to relying on the _once functions.
Alternatively, you could be trying to declare a function that already
exists in php.
For example I was trying to define a mysql_escape_string function - but
one was included in v4.0.3 !