blog

 

strpos and the joys of dynamic typing (2018-07-12)

PHP is one of the languages which interpret the type of the content of a variable the moment it is used. Something unfitting will be converted by a set of rules so that the operation can be executed. So, through this, we can add a string to an integer, if the string is numeric, it will work and result in either an integer or a float. Of course this has limits and pitfalls ...

read more


 

Handling dates (2018-06-14)

Another phenomenon I encounter relatively often is creative and thus usually quite flawed date handling or date calculations. Mostly, it's the small things. People use unix timestamp (the number of seconds since the unix epoch - 1970-01-01 00:00:00) and by that store time and date as an integer in their database instead of ...

read more


 

Build a Tree from Database Records (2018-06-10)

When it comes to storing (and then building) a tree, there are different approaches. One of them is storing each node as a record of the same table and specifying a parent id for everything but the root node. Transforming this then into a structure of nested objects in PHP can be quite adventurous. ...

read more


 

parallel processing with php (2018-05-22)

PHP is single threaded. No way around it (if you can't bring Facebook's Hack on the table). This also means that almost every command or function in PHP is a blocking operation. Meaning that the main program (script) has to always wait for results of e.g. database operations, webservices, command line jobs and many more.<br> Although this is usually not a problem and actually leaves some complexity out - arguably, I know, one can sometimes feel the impact by a cascade of degrading performance as soon as an external source is a bit busy. ...

read more


 

array_unique - as bad as possible (2017-08-17)

A phenomenon I encounter quite often is programmers spending hours on reinventing a feature, function or construct of the programming language or framework they use. In PHP - from what I've seen so far - the most common one is ...

read more