Jump to content

[SOLVED] PHP 'Cannot redeclare function'


Recommended Posts

Ok, I'm getting this error:

Fatal error: Cannot redeclare upload() (previously declared in C:\...\functions.php:2) in C:\...\functions.php on line 110

 

I've gotten this error before, and I know what the main cause is. But this isn't due to declaring a function twice (or atleast I don't see it). Here are lines 2 and 110 of functions.php

 

Line 2 (1-3):

<?php
function upload($set=array()){     // line 2
global $error;

 

Line 110 (109-111):

	return (empty($error)) ? true : false;
}     // line 110
// this is line 111. just a newline

 

What could be the problem? All the braces match up.

 

Wes

Link to comment
Share on other sites

You'll have to post more code. I can't decipher anything from that.

 

Though if you're going to return true or false based on empty($error), just do

return empty($error); // the empty function already return a boolean value

Link to comment
Share on other sites

You're probably including the file twice or something.

 

That was it.. it was hidden.. sorry, that's what happens when you make yourself work on the weekend.

 

I'll bet that the function that ends around line 110 is called upload too.

 

Negative.. it was all the same function. I'm not THAT tired ;)

 

Thanks everyone!

 

Wes

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.