Thomas Hambach

Thoughts of a webdeveloper

Category: snippets

PHP Get monday, sunday, last monday & last sunday

A function I’ve put togheter for a work-related project to get date of monday, sunday, last monday & last sunday.. Might add in next monday and sunday later. /** * Get Mondays and Sundays * * Get monday, sunday, last monday & last sunday * Example usage: * // to retreive the dates using today [...]

vTiger slow account/products popup

After plowing through tons of code from both vTiger and ADOdb and pushing Google search to the max, I finally found a forum topic on vtiger.com covering the problem we were having with vTiger. The problem was that the popup to select an account or a product had load times averaging 60seconds. That’s a huge [...]

always_populate_raw_post_data disabled? here’s a workaround

Since HostGator does not support changing the value of always_populate_raw_post_data in PHP to “1″, I had to find a work around. After spending an hour Googling my issue and it turning zero-dot-zero results I was forced into being creative. Appearantly you can use the input wrappers to go around this setting. Perhaps you could find [...]

All cities of Belgium with postal code and GPS location

Although, to you foreigners, it may seem like there is not going to be a Belgium in the near future … For a project of mine, I had to find a database that contained all cities of Belgium with their postal codes and GPS locations (longitude & latitude). Since I couldn’t find such a database [...]

best self written PHP function. ever.

Okay, maybe I’m overrating it, but I still love it for debugging purposes… unless you are using the CLI. [snippet] function pre($array) { echo ‘<pre>’; echo print_r($array); echo ‘</pre>’; } [/snippet]