...

View Full Version : Need Help Building a dataset



macleodjb
11-23-2011, 01:21 AM
Hi Guys,

I am trying to build a dataset to use within a chart. My brain for some reason doesn't seem to be connecting the dots tonight on how to achieve what I want. I am looking to combine 3 or more array keys into one array.

Example.


Array1
(
[0] => 3
[1] => 8
[2] => 2
)

Array2
(
[0] => 4
[1] => 8
[2] => 1
[3] => 2
[4] => 5
)

Array3
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)

Now both the array size and array quantities are a variable. I may have 40 arrays to combine or just 3 like this example.

I need to combine it to look like this.


array
)
[0] => array(3,4,1)
[1] => array(8,8,2)
[2] => array(2,1,3)
[3] => array(null,2,4)
[4] => array(null,5,null)
)


Any help is appreciated. Thanks in advance.

XterM
11-23-2011, 01:34 AM
make array1, 2, and 3 with same name bro.


$data[] = array("3","8","2");
$data[] = array("4","8","1","2","5");
$data[] = array("1","2","3","4");


so, you just need to add $data[].

macleodjb
11-23-2011, 01:51 AM
How will i handle null entries in the array? What you have suggest isnt exactly what i was looking for, but thank you.

XterM
11-23-2011, 02:16 AM
the length of all array same?

macleodjb
11-23-2011, 03:53 AM
no the length of the arrays can change.

XterM
11-23-2011, 06:47 AM
i don't understand why you are worried about null entries.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum