[phpa] Cannot redeclare function errors

  • From: "PHP Accelerator" <php_accelerator@xxxxxxxxxxx>
  • To: phpa@xxxxxxxxxxxxx
  • Date: Tue, 11 Sep 2001 00:42:48 +0100

Hi,

A problem has come to light with conditional function definitions such as:

if ($x == $y) {
  function boo() {
    echo "Boo\n";
  }
}

This will cause a 'Cannot redeclare boo()' error. The workaround, and 
perhaps more efficient code design, is to put the conditionally defined 
functions into a separate file and include that with an include_once 
statement instead.

e.g.

if ($x == $y) {
  include_once "boo.inc";
}

A fix for this is being worked upon.

Nick


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts:

  • » [phpa] Cannot redeclare function errors