Re: array_diff usage
| From: | Unknown Sender | Date: | Mon, 02 Apr 2001 08:40:57 +0000 |
| Subject: | Re: array_diff usage | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46577@lists.php.net to get a copy of this message | ||
On Mon, Apr 02, 2001 at 12:41:07AM -0700, V e r b a l wrote:
> 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
So the arrays contain one string each? array_diff() won't work then.
Try this:
$a = array(1, 2, 3, 4, 5);
$b = array(1, 2);
$test = array_diff($a, $b);
$lines = count($test);
echo $lines;
var_dump($test);
The output should be:
3array(3) {
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
Stig