I'm currently working on a simple php function for an entity in the framework Symfony2. That function keeps generating errors, although I cannot see what is wrong. Here's the code :
public function getForm(array $reqFields){
var $formHelper = new FormHelper;
var $fields = new array;
if($reqFields == null){
foreach ($this->getArray() as $k => $v) {
array_push($fields, $formHelper->getTextField($v, $k));
}
}
return $formHelper->getForm($fields);
}
I've imported FormHelper, and the functions in it exist, for that matter. When I execute it, I get the following error:
Parse error: syntax error, unexpected T_VAR
What's the problem?
Edit: Netbeans tells me that $reqFields should be initialized (but it's an argument :/), and that an identifier is expected on the return line.