Tips for PHP code reutilization?
Posted: Wed May 22, 2024 9:43 am
Hi all,
As my demo project start growing, I have to start thinking in reuse the same code I need in several different places. In standard PHP we move this code to libraries/classes and "include" them.
I guess here we have to use nuProcedure and/or nuRunProcedure.
I see nuProcedure returns the code as string to eval it, and nuRunProcedure executes directly this procedure.
Would like to know the "nuStandard" way to reuse code and "send params/receive data" from this code inside procs (returns? hash cookies?). There are ways to put several functions and reuse from one procedure? Main advantages/disavantadges between nuProc and nuRunProc? It's better to use a procedure for each function? What suggestions are about all of this?
Thanks.
As my demo project start growing, I have to start thinking in reuse the same code I need in several different places. In standard PHP we move this code to libraries/classes and "include" them.
I guess here we have to use nuProcedure and/or nuRunProcedure.
I see nuProcedure returns the code as string to eval it, and nuRunProcedure executes directly this procedure.
Would like to know the "nuStandard" way to reuse code and "send params/receive data" from this code inside procs (returns? hash cookies?). There are ways to put several functions and reuse from one procedure? Main advantages/disavantadges between nuProc and nuRunProc? It's better to use a procedure for each function? What suggestions are about all of this?
Thanks.