I have a function(this is exactly how it appears, from the top of my file):
Since the code you've provided does not explicitly include anything, either it is being incldued twice, or (if the script is the entry point for the code) there must be a auto-prepend set up in the webserver config / php.ini or alternatively you've got a really obscure extension loaded which defines the function.
I want to add my 2 cent experience that might be helpful for many of you.
If you declare a function inside a loop (for, foreach, while), you will face this error message.
I'd recommend using get_included_files
- as Pascal says you're either looking at the wrong file somehow or this function is already defined in a file that's been included.
require_once
is also useful if the file you're attempting to include is essential.
or you can't create function in loop
such as
for($i=1; $i<5; $i++) { function foo() { echo 'something'; } }
foo();
//It will show error regarding redeclaration
You're probably including the file functions.php more than once.
you can check first if name of your function isn`t exists or not before you write function By
if (!function_exists('generate_salt'))
{
function generate_salt()
{
........
}
}
OR you can change name of function to another name