Jump to content

include() a function in a class definition


timbrown

Recommended Posts

ok, you might have a function in an include file like this -

 

thefunction.inc

 

function functionName(){
some code...
}

 

and I want to include that function in a class definition as a method like this -

 


class className {
public someVar = "";
public someVar = "";
public someVar = "";

// defining a method normally
function someFunction(){
some code...
}

// define one using the include
include("thefunction.inc");



}

 

this doesn't work because php is expecting a function, not an include.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.