Steve:

If the capitalization of the two file names is different then
require_once() will treat them as different files. Thus the following
does not work.
require_once('funcs.php');
require_once('Funcs.php');

Regards,
Chris Wood


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Steve Harp
Sent: Wednesday, October 05, 2005 8:13 AM
To: [email protected]
Subject: [php-list] require_once confussion

Hi All,

If I understand the manual, require_once() is used when code should only
be included once.  I have a funcs.php that contains several functions
used by various scripts.  When I have a.php that uses
require_once('funcs.php'), then I start a script as follows:

<?php
  require_once('funcs.php');
  require_once('a.php');    // barfs here

  // do some cool stuff
?>

I get an error from the Zend debugger, "Compile Error..funcs.php line
4 - Cannot redeclare func_name() (previously declared in funcs.php". 
What am I doing wrong?  The php manual says "if the code from a file has
already been included, it will not be included again". 
Apparently, the require_once() function is not working or I'm not
understanding its' usage.

I can see were this could become a real nightmare trying to keep track
of what's included in deeply nested files.  Is there a way to protect
against this error?

Thanks,
Steve




------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet
Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to