Jump to content

Calling class when class name is build from variables.


Recommended Posts



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.

Link to comment
Share on other sites


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.