Page 1 of 1

[Solved] Problem regarding Redeclaration of a function

Posted: Wed Aug 10, 2005 10:16 am
by waqas_punjabian
Hi ,

how's everybody, hope f9 .... But i m not well, cause of this <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> problem....

Kindly solve it :

i got an error in "lib.php" basically in this file i've defined common functionality of my

website in functions now i 've include it in header of my website because header is include

at each page now i got the following error ...

Fatal error: Cannot redeclare convertforstorage() (previously declared in

/home/content/s/u/m/sumitdua/html/test/includes/lib.php:2) in

/home/content/s/u/m/sumitdua/html/test/includes/lib.php on line 2


i m fed up because in "lib.php" the method "convertforstorage()" is declared just for one

time. And one thing more i 've tried to comment out this function in "lib.php" after that i

've found error on next defined method.i.e) "convertfordisplay()" and if i comment it too,

then found on next method and so on..........

Is there any technical reason for that ... kindly help me i m really worried about this

problem.

Thanks in Advance

regards
Waqas

Posted: Wed Aug 10, 2005 10:37 am
by shiznatix
the only reason is if you are creating the function twice. im sure if you look hard enough you will find it

Posted: Wed Aug 10, 2005 10:39 am
by nielsene
How are you including your files? are you using include/require or include_once/require_once? Is it possible that you're including the file twice?

Re: Problem regarding Redeclaration of a function

Posted: Wed Aug 10, 2005 10:41 am
by neophyte
waqas@balianti.com wrote:Hi ,

i got an error in "lib.php" basically in this file i've defined common functionality of my

website in functions now i 've include it in header of my website because header is include
Are using include_once() or require_once() as opposed to include(); requrie();. That might solve your problem as well.

Thanks U all of gr88888 buddiesssss

Posted: Thu Aug 11, 2005 12:59 am
by waqas_punjabian
Hurraaahhhhhhhh !!!!


Error have been solved, Yeah, i 've used "require_once()" instead of "include()" ....... and this <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> 've been solved....


Once again thanxxxx a lot

Ba Bye :lol:

Posted: Thu Aug 11, 2005 3:08 am
by feyd
watch your language waqas@balianti.com...

Posted: Thu Aug 11, 2005 3:14 am
by CoderGoblin
From a maintenance stand point if you design your code well, you should not need to use include_once/require_once. If you have the same function in multiple places maintaining them can become a nightmare as changes to one should be updated in all the others.