Sometimes, you need to know the name of the function that called the function you’re currently in. In my case, it’s a logging method in a class. PHP has the magical constant __FUNCTION__ that gives you the name of the current function, but nothing to get the calling function. You can use debug_backtrace() to get [...]
Unless you live under a rock, you know about the magnitude 9.0 earthquake that hit Japan around 3 p.m. local time. The quake has caused many deaths, partial nuclear meltdowns, volcanic eruptions, and so much more. In fiscal terms, the Nikkei has dropped almost 5% since it reopened after the earthquake and forecasters are already [...]
Say, for instance, you have a table of patterns (in my case: billing rates by telephone prefix) and you need to compare a string (in my case: a telephone number) against the rates. Which should be returned is a single pattern which best matches the string so more specific patterns would be allowed. Here’s my [...]