PHP Best Practice - Read GET/POST parameter multiple times or create variable -
i wondering what's best practice in case. of following code snippets use?
dostuff($_get["param"]); domorestuff($_get["param"]);
or
$variable = $_get["param"]; dostuff($variable); domorestuff($variable);
is there difference in aspect of performance or in how php code should like?
in case first 1 better, @ how function calls recommend use variable?
you should filter parameters in global variable $_get
. best practice store filtered data $_get
in variable , use in other parts of code. filtering approach, because makes code more secure.
there can read filtering input: http://php.net/manual/en/function.filter-input.php
Comments
Post a Comment