therealwesfoster Posted May 30, 2009 Share Posted May 30, 2009 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 https://forums.phpfreaks.com/topic/160303-solved-php-cannot-redeclare-function/ Share on other sites More sharing options...
jxrd Posted May 30, 2009 Share Posted May 30, 2009 You're probably including the file twice or something. Link to comment https://forums.phpfreaks.com/topic/160303-solved-php-cannot-redeclare-function/#findComment-845951 Share on other sites More sharing options...
Ken2k7 Posted May 30, 2009 Share Posted May 30, 2009 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 https://forums.phpfreaks.com/topic/160303-solved-php-cannot-redeclare-function/#findComment-845952 Share on other sites More sharing options...
thebadbad Posted May 30, 2009 Share Posted May 30, 2009 I'll bet that the function that ends around line 110 is called upload too. Link to comment https://forums.phpfreaks.com/topic/160303-solved-php-cannot-redeclare-function/#findComment-845980 Share on other sites More sharing options...
therealwesfoster Posted May 31, 2009 Author Share Posted May 31, 2009 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 https://forums.phpfreaks.com/topic/160303-solved-php-cannot-redeclare-function/#findComment-846041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.