Jagged Edge Arrays in PHP
Posted
by
chriscct7
on Stack Overflow
See other posts from Stack Overflow
or by chriscct7
Published on 2012-09-18T21:25:22Z
Indexed on
2012/09/18
21:38 UTC
Read the original article
Hit count: 341
I want to store some data in (I guess a semi-2, semi-3d array) in PHP (5.3) What I need to do is store data about each floor like this:
Floor Num of Spots Handicap Motorcyle Other
1 100 array(15,16,17) array (47,62) array (99,100)
2 100 array(15,16,17) array (47,62) array (99,100)
and on
The problem is, is if the Handicap+Motorcyle+Other were ints, I could just store the data in a 2d array. However, they aren't. So I was thinking I could make something almost like a 3D array, with the first two columns only being in 2D.
The other thought I had was making a 2D array and for columns 3,4, and 5 instead of saving as
array(15,16)
//save like
1516
And then split at two digits (1 digit array numbers would be prefaced with a 0). However, I am wondering about the limit of the length of a string, because if I decide to move to a 3 digit length number in the array, like array(100, 104), and I need to store alot of numbers, I am thinking I am going to quickly exceed the max.
© Stack Overflow or respective owner