merge 3 arrays in PHP3??
| From: | René Fournier | Date: | Wed, 17 Oct 2001 19:56:03 +0000 |
| Subject: | merge 3 arrays in PHP3?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71386@lists.php.net to get a copy of this message | ||
I'd like to merge three arrays, then sort them, but I have to do it in PHP3
(so I can't use, much to my disappointment array_merge_recursive()). Is
there another [simple] way to do this??
This is what I've got now:
------------------------------------
$array[1] = file ('one.db');
$array[2] = file ('two.db');
$array[3] = file ('three.db');
for ($a = "1"; $a < 4; $a++) {
$contents = $array[$a];
rsort ($contents);
------------------------------------
And this is what I'd LIKE to have (or something like it that works :-)
------------------------------------
$array[1] = file ('one.db');
$array[2] = file ('two.db');
$array[3] = file ('three.db');
$contents = array_merge_recursive($array[1], $array[2], $array[3]);
rsort ($contents);
------------------------------------
Notice, I want to sort the ENTIRE three arrays as ONE array, not subsorts...
(Thanks!)
...Rene
---
Rene Fournier
renefournier@yahoo.com