PHP Nano-Router

Custom routers were all-the-rage a few months ago but I’m afraid I missed the boat, so here’s my so-small-it’s-not-really-a-router router.

Continue reading →

Get a substring between two strings in PHP

So you need to get a substring between two strings? A quick Google returns about 101,000 results, the first three of which are from StackOverflow and solve the problem for rather specific use-cases. I wanted to solve the problem once-and-for-all in a more general-purpose way.

Continue reading →

Converting Objects and Arrays

Unidimensional arrays and objects can be converted by casting (e.g. $array = (array) $object; / $object = (object) $array;) but if multidimensional only the first tier is converted. Here’s the solution!

Continue reading →