Bug #13169 Updated: Problem with array_diff()
| From: | venaas@php.net | Date: | Thu, 13 Sep 2001 18:18:21 +0000 |
| Subject: | Bug #13169 Updated: Problem with array_diff() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-65894@lists.php.net to get a copy of this message | ||
ID: 13169
Updated by: venaas
Reported By: spam@tefen.net
Old Status: Open
Status: Closed
Bug Type: Arrays related
Operating System: Debian
PHP Version: 4.0.6
New Comment:
The problem is that array_diff() doesn't work with array
of arrays any more. File it as a feature request if you
really want it.
Previous Comments:
------------------------------------------------------------------------
[2001-09-06 04:19:46] spam@tefen.net
My site is a series of questions that users answer. In order to track which questions are answered
and which are not I've developed two mysql tables:
inever_statements which contains all the questions and their "statement_id"
inever_answers which contains all the answers for each question from each user
Because mysql doesn't have a method for doing isin queries I've instead loaded two arrays.
One array contains the ids for all the possible questions, the second array contains all the ids
for the questions the current user has answered. By running array_diff() on these two arrays I
should be able to create a list of ids for questions the current user hasn't answered.
This worked perfectly for quite a while. However, the number of questions is now near 600.... I
can load both arays and use print_r() to verify the contents of each. However, running array_diff()
fails if the user has answered a single question.
Is this due to the large number of questions? Is there perhaps a better way to accomplish the same
thing?
One thought I had was to break down the process into a number of smaller comparisions, say limiting
the query to 50 or 100 records. Any other suggestions would be appreciated.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13169&edit=1