Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home2/itechies/public_html/dev/template2.php on line 204
Can I put include or require inside a class definition? :
Ultra fast cheap  linux and windows hosting
    Search code samples  
 
  Keyword
 
 
 
   
 
 
  Code Samples
 
ASP
CSS
Dhtml
Html
Javascript
PHP
 
   
    's Home
 
 
Add faq
View faq
Modify Entry
Modify Profile
Change Password

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home2/itechies/public_html/dev/faq_left_inc.php on line 169
Subscribe
Logout
 
   
 
 

PHP >> General

Can I put include or require inside a class definition?

Visitor Ratings (2) :

Description
No.

You just can't put anything inside a class definition EXCEPT variable
and function definitions.

The following code is *not* legal:

<?
class Database {

/* properties */
var $db_path;
var $db_id;
var $db_fields;

/* Services */
require("open.inc");
require("close.inc");

}
?>


To clarify, the following code *does* work. This because all we have in
the class are variable and function definitions; the require() is inside
the function definition for open().
Code
Select All
 Rate this Resource
 
Home    Blog    Ajax    CSS    Hot scripts    Tips & Tricks    Webmaster Resources     Freelance jobs    Articles    Sitemap    Website builder and Cheap domain names    Lotus Notes FAQ    Our partners