note 29742 added to function.array-diff
| From: | ds2u at rack1 dot php dot net | Date: | Sun, 23 Feb 2003 22:22:05 +0000 |
| Subject: | note 29742 added to function.array-diff | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44409@lists.php.net to get a copy of this message | ||
Yes you can get rid of gaps/missing keys by using:
$result = array_values(array_diff($array1,$array2));
But to drop the storage of void spaces (actually a line feed) which are irritatingly indexed when
reading from files - just use difference:
$array = array ();
$array[0] = "\n";
$result = array_diff($result,$array);
dst
--
http://www.php.net/manual/en/function.array-diff.php
http://master.php.net/manage/user-notes.php?action=edit+29742
http://master.php.net/manage/user-notes.php?action=delete+29742
http://master.php.net/manage/user-notes.php?action=reject+29742