Basic PHP problems -


when use function variables created included scripts retained within scope of function.

function reqscript($script) {     $include_dir = 'inc/';     $page_ext = '.php';     include($include_dir.$script.$page_ext); } 

is there way of me not having use following method?

include(buildfilename('...')); 

if want define variables in included file, have use $globals.

e.g: $foobar = 42; should $globals['foobar'] = 42;

so $foobar available in global scope (outside of functions).

but prefer buildfilename() method.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -