Re: array_diff
| From: | Eugene Lee | Date: | Thu, 02 Oct 2003 10:09:14 +0000 |
| Subject: | Re: array_diff | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164715@lists.php.net to get a copy of this message | ||
On Thu, Oct 02, 2003 at 11:28:23AM +0200, Angelo Zanetti wrote:
:
: I know what the problem was, firstly that when doing an array_diff the keys
: are preserved. Therefore If I was looping through $arrayResult for the count
: of elements (in this case 2) then thats where the blank value comes in. SO
: therefore if I wanted to get all the values out of the $arrayResult that are
: not blank, would I loop through the array the amount of times that there are
: elements in the $array1, because $arrayResult will be the same size as
: $array1 and also because the keys are preserved?
:
: Im not sure if Im heading in the right direction, with regards to gettig the
: values out the $arrayResult.
How about using a foreach() automatically walk the array without having
to worry about the keys?
I wonder if there is a function to re-index an array while preserving
numerical order. If order is not important, a sort() will re-index the
array.