Use Array_map error in class method---cannot redeclare
The method is defined as follows:
Class maaper{
......
Public Function getProperties () {
function GetName ($reflectionProperties) {
return $reflectionProperties->name;
}
$domain = $this->get_domain ();
$reflectionProperties = $domain->getproperties (reflectionproperty::is_public);
$properties =array_map (' GetName ', $reflectionProperties);
return $properties;
}
......
}
The invocation process is as follows (note: $mapper _1, $mapper _2 is called at the same runtime):
$mapper _1=new mapper ();
$mapper _2=new mapper ();
Var_dump ($mapper _1->getproperties ()); return correctly
Var_dump ($mapper _2->getproperties ()); Error cannot redeclare getName ()
As follows:
Share to:
------Solution--------------------
function GetName ($reflectionProperties) {
return $reflectionProperties->name;
}
Define global functions wherever you are