note 69274 added to function.array-diff

From: Date: Tue, 29 Aug 2006 15:21:47 +0000
Subject: note 69274 added to function.array-diff
Groups: php.notes 
Request: Send a blank email to php-notes+get-116477@lists.php.net to get a copy of this message
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; } ---- Server IP: 212.124.37.9 Probable Submitter: 217.91.70.237 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.array-diff.php Edit -- https://master.php.net/note/edit/69274 Del: integrated -- https://master.php.net/note/delete/69274/integrated Del: useless -- https://master.php.net/note/delete/69274/useless Del: bad code -- https://master.php.net/note/delete/69274/bad+code Del: spam -- https://master.php.net/note/delete/69274/spam Del: non-english -- https://master.php.net/note/delete/69274/non-english Del: in docs -- https://master.php.net/note/delete/69274/in+docs Del: other reasons-- https://master.php.net/note/delete/69274 Reject -- https://master.php.net/note/reject/69274 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116477) next »