Sign in to follow this  
Followers 0
scon

How to add value in multi dimensional array?

4 posts in this topic

#1 ·  Posted (edited)

Hi!

I need to fill multi dimensional array from file:

aaa, 23, 34, 345, 123

bbb, 43, 09, 915, 232

........

........

Like this

Global $array[100][5] = [["aaa", 23, 34, 345, 123],["bbb", 43, 09, 915, 232]]

How to make it?

For $i=1 To 100 Step 1

; read and split line from file ($var1, $var2, $var3, $var4, $var5) - it's easy :mellow:

_ArrayAdd($array, ? ) ; how include here $var1, $var2, $var3, $var4, $var5 ?

Next

Edited by scon

Share this post


Link to post
Share on other sites

You may just use something like this:

Global $array[101][6]
Global $i = 1, $j = 1

For $i = 1 to 100 step 1
    For $j = 1 to 5 step 1
        $array[$i][$j] = $var
    Next
Next

Share this post


Link to post
Share on other sites

_ArrayAdd doens't work with multi dimensional array's. you should do it your self in this case.

What makaule said :mellow:


-jaenster

Share this post


Link to post
Share on other sites
:mellow: jaenster, THANKS !!!

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