We’ve coded two validation functions, one is like below (it gets all the fields at once):
function check_fields(&$arr,&$msg,$types,$lens,$captions,$requireds) {}
and the other function is something like below:
function is_valid($field=NULL,$type=0 ,$length=0,$required=true) {}
First function has a few code lines, and reduces code lines dramatically (about 30-35 lines or even more), on the other side the second function without reference increases the code lines (about 30-35 lines or even more).
We have to call the second function for every field we want to validate, but the first function (check_fields) is vice versa.
I’ve read in an article long time ago that functions with reference parameters are bad from a performance point of view.
Now we don’t know which function to use. Which one is better from a performance perspective?
Well I think I got my answer myself after some web searches:
Do not use PHP references