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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -