
WayneA
Good Afternoon.
I want to create an array where I store two string values. For this example I will call it $x and $y. I want to store the variables in the array. I want to store as many as I need.
I understand the definearray command. What I do not understand is how to input in the array and keep adding the string variables. Let me post my example.
#Example ArrayCode:
$x = GetRandomUnique(1,50)
$y = GetRandomUnique(1,100)
DefineArray($z,2)
#when I do this...
$x = $z[0]
$y = $z[1]
#the variables z0 and z1 stay the same everytime i run the script.
Code:
Code:
Are you sure you have it as above?
$variable = "Contents of variable"
So putting $x = $z[0] will cause $x to be the same as what $z[0] is, not the other way around.
Putting the variables around the correct way will solve the problem.
$z[0] and $z[1] wouldn't change if you use AppendArray()
To repeat it 100 times could be done a number of ways, the easiest is with a counter and a repeatuntil()
1 remove the defarray statement out of the main loop of code and only issue the statement once in your code initialization at the startup before storing any values in the array.
2 you need a counter that increments 100 times and use that counters current value as the pointer to which value in the array you want to save or read