php - Is it possible to access variables without putting "global" in front of them in functions? -
my code much more complex this, here's of it:
$string = "wuddup"; function echothis() { echo $string; } echothis();
is there easy way without saying global $string
?
reason being, have check login function, many variables , have config variables outside function...
whatever happened parameters?
function echothis($str) { echo $str; } echothis($string);
if having issues managing variables , scope, chances need refactor code structure.
php
No comments:
Post a Comment