| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2002-06-26 00:48 UTC] alan_k@php.net
  [2002-06-26 01:04 UTC] david-work at robinson-au dot net
  [2002-06-26 01:39 UTC] alan_k@php.net
  [2002-06-26 02:12 UTC] derick@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 14:00:01 2025 UTC | 
Hello The include() and require() statements do not work within a class definition. This may be a parsing problem, or it may behave as designed. See below for an example script and the errors generated. I am running the precompiled binary downloaded from the php.net website. Many thanks David Robinson *** Example 1 <?PHP class test { function f1() { ... } include('file.php'); function f2() { ... } } ?> *** End Example 1 *** Error 1 Parse error: parse error, unexpected T_INCLUDE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' ... *** End Error 1 *** Error 2 Parse error: parse error, unexpected T_REQUIRE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' ... *** End Error 2