coding style - Is it considered good practice to unset PHP variables in this scenario? -
right now, using modified version of oscommerce has lot of variables declared in application_top.php
file (which included when going every file on website first thing).
so instance, if go mypage.php
, application_top.php
included in top.
i want of variables defined application_top.php
file accessible inside mypage.php
file, since used temporary calculations or whatever, whereas others meant accessible page.
what best practise? unset variables meant used in local scope after use, , leave variables meant accessed alone?
use of classes best way, , passing variables need
though assume major rewrite ?
what this
$vars = array_keys(get_defined_vars()); $whitelist = array("var1", "var2" ...); $vars = array_diff(array_keys($whitelist), $vars); foreach($vars $var) { unset($$var); }
Comments
Post a Comment