note 69274 deleted from function.array-diff by nlopess
| From: | nlopess@php.net | Date: | Tue, 19 Sep 2006 15:32:21 +0000 |
| Subject: | note 69274 deleted from function.array-diff by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117321@lists.php.net to get a copy of this message | ||
Note Submitter: Thorsten Schaak
----
If one of the Arrays is empty, array_diff delivers NULL, which is buggy in my opinion.
array($a);
array($b);
$a[] = 'value';
$c = array_diff($a, $b)
echo $c;
This should deliver 'value' but shows '' instead.
Since only my second array can be empty I solved it with an following:
IF ($c == '') { $c = $a; }