Jump to content

Calling class when class name is build from variables.


the_oliver

Recommended Posts

Hi,

 

I need to be able to call a class based on variables.  E.G.

 

I would normally do:

$action = new pattern1()

 

but i would like to be able to do it dynamicaly:

$patNum = 1;
$action = new pattern.$patNum.()

 

Im wondering if that's possible?  If so what would the correct syntax be?

 

Many Thanks.

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.