> -----Original Message-----
> From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 31, 2001 10:52 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] array_diff usage
> 
> 
> I'm daft. I don't understand the PHP Manual.
> 
> I have two arrays:
> Open[0] contains 1 2 3 4 5
> Closed[0] contains 1 2
> 
> Now:
> $test = array_diff($Open, $Closed);

Given the setup you've described, I think you might actually want

        $test = array_diff($Open[0], $Closed[0]);

> $lines = count($test);
> print $lines;
> 
> Gives me: 1
> I thought it should be 3.

Seems appropriate, given the information you've provided.  $Open and
$Closed each have only one element (0).

> While:
> for ($counter =0; $counter <= $lines -1; $counter++)
> {
>         print $test[0];
> }
> 
> gives me "5".

This, on the other hand, makes me suspect that the arrays themselves
don't actually contain what you think they do.  How are you assigning
the values you described at the top of your message?
 

---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
     LeTourneau University      ||                    -- Henry Kissinger


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to