Jump to content

Multidimensional arrays in multiple lines


Recommended Posts

So Im trying to make a simple 2d game and make some sort of collision detection so why not to make a 2 dimensional array but i have no clue how  to write it in multiple lines

Global $map[5,5] = [0,0,0,0,0 _
                   [0,0,0,0,0 _
                   [0,0,0,0,0 _
                   [0,0,0,0,0 _
                   [0,0,0,0,0]

something like this but it doesn't work

Link to comment
Share on other sites

Try in this way:

Global $map[5][5] = [[0,0,0,0,0], _
                     [0,0,0,0,0], _
                     [0,0,0,0,0], _
                     [0,0,0,0,0], _
                     [0,0,0,0,0]]

:)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

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

×
×
  • Create New...