MattyUK
01-18-2006, 12:15 AM
Hi
I am creating a two dimension array. I want to add 2nd dimension values on the same parent index.
Desired output:
[0]=>array([0]='strKeyValueA',[1]='strKeyValueB')
[1]=>array([0]='strKeyValueA',[1]='strKeyValueB')
$output[][]='strKeyValueA';
$output[][]='strKeyValueB';
is no good.
I want to add strKeyValueB on the same parent index as strValueA.
$output[][]='strKeyValueA';
$output[?????][]='strKeyValueB';
Where ????? is some magical way of making sure it is the same index as the line above.
For example:
$output[0][]='strKeyValueA';
$output[0][]='strKeyValueB';
or
$output[1][]='strKeyValueA';
$output[1][]='strKeyValueB';
Would be fine but thanks to surrounding code I need to add these two values into same parent array index creating a parent index as necessary (using []).
What is the best way of doing this?
Hope I've explained it clearly enough.
Thanks in advance.
MattyUK
I am creating a two dimension array. I want to add 2nd dimension values on the same parent index.
Desired output:
[0]=>array([0]='strKeyValueA',[1]='strKeyValueB')
[1]=>array([0]='strKeyValueA',[1]='strKeyValueB')
$output[][]='strKeyValueA';
$output[][]='strKeyValueB';
is no good.
I want to add strKeyValueB on the same parent index as strValueA.
$output[][]='strKeyValueA';
$output[?????][]='strKeyValueB';
Where ????? is some magical way of making sure it is the same index as the line above.
For example:
$output[0][]='strKeyValueA';
$output[0][]='strKeyValueB';
or
$output[1][]='strKeyValueA';
$output[1][]='strKeyValueB';
Would be fine but thanks to surrounding code I need to add these two values into same parent array index creating a parent index as necessary (using []).
What is the best way of doing this?
Hope I've explained it clearly enough.
Thanks in advance.
MattyUK