View Single Post
Old 06-08-2008, 09:26 AM   #6 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

You cannot include (or do very much else at all) directly within the body of the class definition, but you can inside methods.

PHP Code:
class Fail {
    
// Generates parse error
    
include 'myfile.php';

    public function 
no_fail()
    {
        
// Perfectly fine to include within a method
        
include 'nofail.php';
    }

Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
pipesportugal (06-08-2008)