Move that foreach() inside the method

loops goes inside

Move that foreach() inside the method Several PHP functions work with single or multiple values. For example, array_merge(), which merges several arrays into one. Or, isset(), which checks simultaneously the existence of several variables. str_replace() and preg_replace_callback() also come to mind. This approach usually brings a bit of performance, by processing a list of arguments […]

Literal candidates for constants

Literal candidates for constants Literals are hard coded values in the source. Once they are written, they can’t be changed without altering the source code. This is always fine, initially, while building the first implementations. Yet, later, it may arise that such literal have to be managed from different points of the code. This is […]

6 unicity traps that sideline PHP code

Thorny issues

6 unicity traps that sideline PHP code Sometimes, code is being ignored by PHP : code is painstakingly written but never gets executed. How is that even possible? May be, because it was not so painstakingly coded. Indeed, there are some PHP coding structures which natively and silently overwrites or ignore code. This leads to […]

Removing Unused Variables Is Good

Removing Unused Variables Is Good My favorite code clean is removing unused variables. This is right : variables that are hosted in the code, yet doing nothing. In fact, they are often toxic and grow bug-prone. Any old enough code source has them, and they tend to grow by the number. Have you ever tried […]

Exakat 1.6.6 Review

Exakat 1.6.6 Review The Exakat 1.6.6 was born in Miami, during sunshine PHP 19. The conference is incredibly energetic, and with the help of fellow attendees, it provided inspiration for some interesting update : PHP supports strings with logical operators (good for security); Exakat reviews typehint and check if they are sufficient in the method […]

How many parameters is too many ?

How many parameters is too many? Now, that is a classic question, that is often a minefield for anyone writing an increasing long list of argument in a method, or simply trying to set up auditing tools. Obviously, the answer is not immediate. Parameters may be needed, but on the other hands, currying functions allows […]

Exakat 1.1.8 review

Exakat 1.1.8 review After last week double edition’s review, we needed some quiet time. This week, we upgraded the ‘Randomly sorted arrays’, added two new extensions and closed two nasty bugs. So, here it is, your moment to read the Exakat 1.1.8 review. Support for IBM Db2 and Leveldb ext/ibm_db2 is an interface to IBM […]

Exakat 1.1.4 review

Exakat 1.1.4 review A new week, and an incredible harvest of PHP tricks. Some made it to the Exakat engine, so as to support the language handling; some made it to the analysis, so as to help us develop better. Tricks include array_keys’s extra parameters, unicode codepoint, constant scalar expressions and arrays (sic), dir . Let’s review […]

exakat 0.12.3 review

Exakat 0.12.3 review Exakat 0.12.3 is out like a hot summer diner. For this week’s menu, we are served with support for the new PHP 7.2 syntax in grouped use, 2 analysis hunting down default values and typehint mismatches, and a recommendation to start using the Null Object Pattern. Exakat now also delivers data in […]