........... >:( >:( >:(
Wrap functions inside !function_exists conditional if the resource is needed to run more than once on a page
If you call a snippet twice on a page, it will throw up a parsing error saying something like "Cannot redeclare functionName()". So, if you need it to be possible to run your snippet multiple times on a page, you need to wrap it inside a !function_exists conditional block.
}function rnCountRows() { ... } // bad if(!function_exists(rnCountRows)) { // good function rnCountRows() { ... }
You can’t unset the vars at the beginning -- that will wipe out the variables being set by the snippet parameters. It’s much better to write reusable functions or classes you can create objects from for each snippet instance. Otherwise, you are executing code in the global scope, and all global variables will be considered and used, including any set of previous executions of the same snippet.
Also always unset() the vars, since I set the vars in the beginning I only unset at the end but to use it in both cases is not a bad idea.
You can’t unset the vars at the beginning -- that will wipe out the variables being set by the snippet parameters.Of course, good point.

