In my continuing story of PHP hilarity...
Today I couldn't figure out why one if() condition was not firing. So I stuck in some error_log() statements at various points in the methods involved to find out what was wrong. I had them output their debug info with leading dashes so I could see the nesting level at a glance, something like:
foreach($something as $thing) {
error_log("--got here");
// later...
error_log("----$count");
// later...
if($count > 0) {
error_log("------in the if");
// do stuff that wasn't getting done for some reason
}
Debug output looked like
--got here
-----4
--got here
-----6
--got here
-----5
Couldn't figure out why the if() condition wasn't firing, until I changed the middle error_log() to:
error_log("****$count");
...at which point the output was:
--got here
****-4
--got here
****-6
--got here
****-5
...and realized I hadn't noticed that 5th "-". :rolleyes:
(Root cause of the problem was that I had set $count as $x - $y, when it should have been $y - $x.)
PS: Shout-out to Rulian for helping me see my silly mistake, even if the reason he thought the dashes were the problem was not the actual reason, but he got me to change them to "*" in any case. 🙂