Jump to content

Declaring of $variables INSIDE functions conflict?


Recommended Posts

Hi to all the good guys 'n girls here. I have a minor question to ask...not serious, but curious :unsure:

I have a MAIN GUI-Window running with a lot of "FUNC()" that also contains GUI-Menu's.....

In all of my functions, i have declared $variable's that has specifically been assigned to THAT particular Func-Gui (so to speak).

Although there are 100's of "Duplicate" $variable's (that occurs in all the Func's, I haven't had ONE error...and my script works 100%...

My question now is...Is there anything WRONG of doing it THIS way?

PS: saves a HELL a lot of time comparing duplicates doing it this way though...

Link to comment
Share on other sites

A variable declared inside a function (Local $var) will be known only inside that function.

If you declare a variable outside any function or if you specify "Global" then that variable will be known everywhere (inside function or outside).

Have a look at "Variables" in the help file.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

A variable declared inside a function (Local $var) will be known only inside that function.

If you declare a variable outside any function or if you specify "Global" then that variable will be known everywhere (inside function or outside).

Have a look at "Variables" in the help file.

Thanks enaiman...just the answer i was looking for ;-)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...