Hi all, I like the object oriented face of php, but can anyone tell me how I can dynamically include classes into my script ?
I mean if I have a 100 classes then I have to include them all though I am not sure which one I will really use ?
Think of FormHandler objects... I dunno which to include unless the user submits a page... and I dont want them all included...
do you have any idea ?
thx
Khayll
import like thing in php?
Moderator: General Moderators
you may include php scripts at anytime,i.e.
Code: Select all
switch($_POSTї'actionType'])
{
case 'one':
include_once('classOne');
$handler = new classOne;
break;
case 'two':
include_once('classTwo');
$handler = new classTwo;
break;
...
default:
include_once('classError');
$handler = new classError;
break;
}
$handler->perform();