Re: Finding missing numbers in an array

2009-08-04 Thread Braindead
Or the Cake way: http://book.cakephp.org/view/666/diff $missing_numbers = Set::diff($the:array, $the_complete_array); On 4 Aug., 11:36, Fran Iglesias wrote: > You could try > > $missing_numbers = array_diff($the_array, $the_complete_array); > > El 04/08/2009, a las 9:57, liaogz82 escribió: >

Re: Finding missing numbers in an array

2009-08-04 Thread Fran Iglesias
You could try $missing_numbers = array_diff($the_array, $the_complete_array); El 04/08/2009, a las 9:57, liaogz82 escribió: > > Hi all, > > I know this is not directly related to cakePHP but i am cracking my > head trying my best to figure out how to discover a missing number in > an array in

Re: Finding missing numbers in an array

2009-08-04 Thread Peter N.
Why not do for($I = 0; $i < 10; i++) if(!in_array($i, $missing_array2)) array_push($missing_nums, $i); On Tue, Aug 4, 2009 at 12:57 AM, liaogz82 wrote: > > Hi all, > > I know this is not directly related to cakePHP but i am cracking my > head trying my best to figure out how to discover a missin

Finding missing numbers in an array

2009-08-04 Thread liaogz82
Hi all, I know this is not directly related to cakePHP but i am cracking my head trying my best to figure out how to discover a missing number in an array in php. Let me give you this example: $missing_array1 = array(1,2,3,4,6,7,8); The missing number for the above array is 5. $missing_array2