note 29742 modified in function.array-diff by vrana

From: Date: Tue, 17 Aug 2004 13:57:37 +0000
Subject: note 29742 modified in function.array-diff by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79792@lists.php.net to get a copy of this message
Yes you can get rid of gaps/missing keys by using: <?php $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: <?php $array = array (); $array[0] = "\n"; $result = array_diff($result,$array); ?> dst --was-- 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://php.net/manual/en/function.array-diff.php

« previous php.notes (#79792) next »