note 53721 added to function.include
| From: | nigelf at esp dot co dot uk | Date: | Fri, 10 Jun 2005 12:44:15 +0000 |
| Subject: | note 53721 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90223@lists.php.net to get a copy of this message | ||
You cannot use an "include" within a class, outside of a function declaration. Doing so
will produce an error "unexpected T_INCLUDE".
For example:
I wanted to move some class variables (arrays) into an include file, as they were used across
several classes, and it would make any changes easier to manage. However, as class variables are
declared outside of a function block they can't then be included.
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53721
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53721&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53721&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53721&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53721&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53721&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53721&report=yes
Search -- http://master.php.net/manage/user-notes.php