I have this array:
$methodsOutput = array("MidUpperArmMuscleArea","ArmSpan_HeightEstimation","BMIBeforePregnancy",
"PregnancyTotalWeightGain","PregnancyWeeklyWeightGain","MS_CurrentBMI_BMIPregnancyWeeks",
"PregnancyDueDate","PregnancyWeeks","WeightEstimation","WHO_BMI_2000_IdealBMI",
"WHO_BMI_2000_IdealWeight","WHO_HeightAge_2006_IdealHeight","WHO_WeightAge_2006_IdealWeight");
and for each one I have the respective class (all included in file).
How can I instantiate dynamically this.
I try this:
foreach($methodsOutput as $method) {
$$method= new $method();
}
but get:
Fatal error: Class ‘MidUpperArmMuscleArea’ not found in…
Do you have that class “MidUpperArmMuscleArea” ?
You could to use class_exists to test.