Re: Redeclare formatdate
| From: | Miguel Br�s | Date: | Sat, 01 Feb 2003 23:19:53 +0000 |
| Subject: | Re: Redeclare formatdate | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133935@lists.php.net to get a copy of this message | ||
Thx for the help...
Miguel
"Jason Sheets" <jsheets@php.net> escreveu na mensagem
news:1044141567.4059.5.camel@daemon.shadotech.biz...
> This is a good reason to use include_once and require_once.
>
> Jason
>
> On Sat, 2003-02-01 at 15:59, John W. Holmes wrote:
> > > 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/
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>