On Tue, Feb 09, 2010 at 09:01:19PM +0000, James Bensley wrote:
I think Ian is correct but also you try going mad with debugging power?
foreach($data['date'] as $key => $date) { echo $date; $date = $this->_convertDate(trim($date)); echo $date; if (!$date) unset($data['date'][$key]); echo $data['date'][$key]; else $data['date'][$key] = $date; echo $date; dbglog($data, "Converted data"); }
A silly idea but sometimes it helps me to see the $variable being carried along through each line so I can find the problem line.
Yes, I ended up doing almost exactly this, it works as it should with $key getting set ti 1, 2, 3, 4, etc.
The error in the code I was trying to debug was *something* to do with foreach not workign with arrays of one entry (or the one entry not making an array of what was supposed to be an array).