setting vars in function
Posted: Tue Aug 17, 2004 11:42 am
functions.php
and on another file which inludes functions.php
but I'm having sort of a brain bubble.
I know the function will delete all the vars it creates at the end of a function but how do I get this var to remain set, so it acts like it was set by $vars["varname"]
Code: Select all
<?php
function svar($var,$condition)
{
$vars["{$var}"] = $condition;
return $vars[$var];
}
?>Code: Select all
<?php
$varcontrol->svar("article_header",$row["title"]);
?>I know the function will delete all the vars it creates at the end of a function but how do I get this var to remain set, so it acts like it was set by $vars["varname"]