Dear, I have a system where the user (with development permission) can schedule some online routines, to be executed within the system, without the need to create file and call via require / include.
To execute this function, I use create_function, but the problem is that when creating this function within a loop for example, the error "can not redeclare class xxxx" occurs.
If the routine is created like this: class aaa{/codigo/}
And I looped to execute:
for ($i = 1; $i <= 5; $i++) {
$funcao = create_function('', $codigoLidoDoBD);
$funcao();
}
The error occurs because even though the function name is different, the aaa class has already been declared and registered somewhere: S
Obs : I could use class_exists in each class, but there are too many to change ...
Obs2 : Sometimes even declaring create_function
out of loop and calling only $funcao()
, the error also occurs.
Does anyone know how to solve it?