Click to See Complete Forum and Search --> : 2 questions about functions in PHP...


diamonds
07-17-2003, 02:32 PM
Is thre a function in PHP that will return TRUE or FALSE if a function is set or not(without calling it!)?
(... if(isfunctionset(function)){}else{} ...)
I am just wondering...

and, Can you edit a global variable inside a function?

$my_not_your_global_var = '';

function change($add = ''){
$my_not_your_global_var .= @$add;
}

I am having trouble with the second one mostly.

An awnser to these questions would make my life programing life a lot more easy!

pyro
07-17-2003, 02:41 PM
On number one, I don't think so...

On number two, you need to define them as global variables:

<?PHP
function change($add = "test"){
global $my_not_your_global_var;
$my_not_your_global_var = $add;
}
change();
echo $my_not_your_global_var;
?>

diamonds
07-17-2003, 02:49 PM
wheew-- almost posted another thread(silly me)

Great! can you explain what the change function does?

diamonds
07-17-2003, 02:58 PM
Oh--- nevermind! I see it!

diamonds
07-17-2003, 03:15 PM
Thanks!

pyro
07-17-2003, 05:50 PM
You're welcome... :)