Sign in to follow this  
Followers 0
MariusN

Speed-up variable declaration using array

10 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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 :)

Share this post


Link to post
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? ;)

Share this post


Link to post
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..

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks guys...will check it out ;)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
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!! ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0