On Tue, Feb 09, 2010 at 10:12:52PM +0000, Ian Porter wrote:
Chris
On Tue, Feb 9, 2010 at 10:03 PM, Chris G cl@isbd.net wrote:
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).
Great that you sorted it :)..
I do find php a nice language at times.
I much prefer python but PHP is OK.