Jump to content

Speed-up variable declaration using array


MariusN
 Share

Recommended Posts

Lets say i have 100 Variables ie $line1, $line2, $line3 up to $line100...Is there a way that i can add a ARRAY

in the GLOBAL area ie $array = $line[0] to $line [99] ?

Something like that so i dont need to enter 100 x $line(whatever)

tia

Edited by MariusN
Link to comment
Share on other sites

If you ended up with 100 variables like $line1, $line2 ... that is a bad code practice.

What you ask for is not very easy done; you need to read about Assign and Eval ... enough to say that it takes you less time to create an array from the begining ($line[0], $line[1] ...) than fixing the current code.

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

If you ended up with 100 variables like $line1, $line2 ... that is a bad code practice.

What you ask for is not very easy done; you need to read about Assign and Eval ... enough to say that it takes you less time to create an array from the begining ($line[0], $line[1] ...) than fixing the current code.

Have a heart...I'm not a "fundi" like you guys, but trying to be at the end. I guess we all have to start somewhere,

right? ;)

Link to comment
Share on other sites

As mentioned before, i admit being a total NOob when it comes to arrays.

Anyone here knows a geniune GENIUNE good tutorial on arrays? Al my coding i've done in the past i have tried to "bypass" arrays, but i think at the end, it'll make my programming MUCH easier...

Thanks guys..

Link to comment
Share on other sites

Kannst du Deutsch?

http://www.bug-fix.info/array_tut.htm

Otherwhise try this

http://translate.google.de/translate?u=http%3A%2F%2Fwww.bug-fix.info%2Farray_tut.htm&sl=de&tl=en&hl=&ie=UTF-8

Link to comment
Share on other sites

As mentioned before, i admit being a total NOob when it comes to arrays.

Anyone here knows a geniune GENIUNE good tutorial on arrays? Al my coding i've done in the past i have tried to "bypass" arrays, but i think at the end, it'll make my programming MUCH easier...

Thanks guys..

There's a tutorial on arrays in the Wiki.
Link to comment
Share on other sites

Last question...Am i wrong if i say that you hardly use arrays in compiling utilities, and that arrays are more to do with Databases AND Calculations?

or is it just a personal preference type of thing...

just out of curiosity

Edited by MariusN
Link to comment
Share on other sites

Last question...Am i wrong if i say that you hardly use arrays in compiling utilities, and that arrays are more to do with Databases AND Calculations?

or is it just a personal preference type of thing...

just out of curiosity

Hey guys...I'm feeling so "chuffed" about myself as i have just figured it out...DAMN!! ;)
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...