RE: [PHP] Redeclare formatdate

From: Date: Sat, 01 Feb 2003 22:59:11 +0000
Subject: RE: [PHP] Redeclare formatdate
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133931@lists.php.net to get a copy of this message
> I have this message coming when calling the page main.php > > Fatal error: Cannot redeclare formatdate() in > /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 > > the code related to this message is: > > <? > // format MySQL DATETIME value into a more readable string > function formatDate($val) > { > $arr = explode("/", $val); > return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0])); > } > ?> > > I use this code is some other pages and it works well, but here the code > is used in page not_main.php whose I included it on main.php using > require() > function Your function is being declared twice, which means that this file is probably being included or required twice. Look through your code... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#133931) next »