Help with a home-grown function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, all -

I've been looking around for a function that would tell me if a $value
in a $key=>$value array was empty, and I could not find one.  So I
decided to make my own.  Even if I am re-inventing the wheel, I thought
that the practice might be good for me.

However, my function doesn't *quite* work, and I'm having a difficult
time finding out why.  The code is as follows:

function findMissingVals($workingArray) {
	$newcount = count($workingArray);
	for ($i = 0; $i <= $newcount; $i++) {
		if (empty($workingArray['$i'])) {
			return 1;
		}
	}
}

So it takes in $workingArray as an array, runs a loop, checks $i, yada
yada.  The thing is, that sometimes the function does not return 1, even
when it should.

I was hoping some experienced eyes could take a gander at this and give
me some pointers.

Thanks!
-dant

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux