I am trying to loop through this
public static function CSS() {
$filenames = array(
"css/tableStyles.css"=>"function1()",
"css/resetCSS.css"=> "function2()"
);
foreach ($filenames as $filename=>$method){
CSS::$method;
}
}
public function1(){
//do something
}
public function2(){
//do something else
}
}
I get a run time error.
any tips?
edit:
thank arxanas,
The answer is :
$filenames = array(
"css/tableStyles.css"=>"function1",
"css/resetCSS.css"=> "function2"
);
foreach ($filenames as $filename=>$method){
CSS::$method();
}
Does
CSS::function1even exist? You haven’t shown it. And in any case, you shouldn’t have parentheses where you havefunction1(). Instead use