[UPHPU] Renumber - Sort through arrays
Mitch Anderson
mitch at metauser.net
Wed Sep 7 16:03:47 MDT 2005
K, I have a question regarding a multi dimensional arrays. I have two
multi dimensional arrays, and I loop through one of them removing
records from the other that match the data in the first, this works fine
however it leaves me with numbering errors when I try to output the
information from the array... Let me illistrate...
Array 1:
Array
(
[table1] => Array
(
[0] => Array
(
[id] => 7
[name] => Name1
[data] => Data for Name1
)
[1] => Array
(
[id] => 3
[name] => Name2
[data] => Data for Name2
)
[2] => Array
(
[id] => 4
[name] => Name3
[data] => Data for Name3
)
)
[table2] => Array
(
[0] => Array
(
[id] => 9
[name] => Name4
[data] => Data for Name4
)
)
)
Array 2:
Array
(
[table1] => Array
(
[1] => Array
(
[id] => 3
[name] => Name2
[data] => Data for Name2
)
)
)
After I remove the contents of Array 2 from Array 1, I get this:
Array
(
[table1] => Array
(
[0] => Array
(
[id] => 7
[name] => Name1
[data] => Data for Name1
)
[2] => Array
(
[id] => 4
[name] => Name3
[data] => Data for Name3
)
)
[table2] => Array
(
[0] => Array
(
[id] => 9
[name] => Name4
[data] => Data for Name4
)
)
)
I'm wondering how I can get $array['table1'][2] to be renumber as
$array['table1'][1]?
Do I have to dump it all to a new array? (This array will have hundreds
of entryies in it in both table1 and table2 arrays) or is there a
function that would do this that I'm not seeing/understanding on php.net?
Mitch
More information about the UPHPU
mailing list