Unraveling the Quest for the Fastest Case Insensitive Char Comparison in PHP

Recently, I delved into a piece of code that involved a case-insensitive comparison of a character to a specific letter. The code, though straightforward, had room for optimization. Not being a fan of lengthy logical expressions, my curiosity led me to explore ways to make it more concise and potentially faster. What is the fastest […]

Building analysis to get ready for PHP 8.3 with static analysis

Building analysis to get ready for PHP 8.3 with static analysis With PHP 8.3 coming up next week, it is time to review our code bases with static analysis, and update everything that can be before the new version hits the production server. With a mixed bag of new features, changed behaviors and backward incompatible […]

Mastering the (array) Cast Operator in PHP

Mastering the (array) Cast Operator in PHP: A Comprehensive Guide PHP provides various tools and features to manipulate data efficiently. One such feature is the (array) cast operator, which transform data into an array. In this blog post, we are mastering the (array)cast operator in PHP, focusing on its applications with simple scalars, objects, arrays, […]

Collateral behavior changes with PHP 8.0 switch()

Collateral behavior changes with PHP 8.0 switch() PHP 8.0 introduced a modernisation of the comparison between integers and strings. It changes the result of comparisons when a string is compared to an integer. Obviously, it includes comparing 0 and ” (empty string). This means that some comparisons were true in PHP 7, and are not […]

array_filter() versus Loop Condition Checks

array_filter() versus Loop Condition Checks Optimizing your code for performance is important, especially when dealing with large arrays or complex data structures. One common dilemma developers face is whether to use array_filter() to preprocess an array before a loop or to check a condition inside the loop and skipping the unwanted values. In this blog […]

Well-Structured Switch Command in PHP

Ensuring a Well-Structured Switch Command in PHP In PHP, the switch statement is a powerful tool for controlling program flow, especially when dealing with multiple conditional branches. However, achieving a clean and efficient switch has its own snags. This post explores essential tips and practices for checking the quality of a ‘switch’ command to ensure […]

New PHP error messages in PHP 8.3

WIndow onto PHP 8.2

New PHP errors messages in PHP 8.3 The upcoming PHP 8.3 is bringing some new errors messages. They originate from new features, deprecated ones, and extra checks on the source code. Let’s review the new PHP error messages in PHP 8.3 and get our code ready for November 2023. Previous review New error messages in […]

The Clean Code Solution for Your DevOps Workflow in PHP

devops php

Introduction In today’s fast-paced software development landscape, DevOps has become a vital part of ensuring efficient and seamless delivery of applications. While DevOps practices enable collaboration and automation between development and operations teams, maintaining clean and high-quality code remains a challenge. This is especially true for PHP developers, who often encounter difficulties in identifying code […]

PHP 8 Attribute usage in 2023

PHP 8 attributes in 2023 PHP 8 introduced the attributes, in lieu of the phpdoc comments. They may be added to classes, methods, functions, parameters, properties and class constants and provide a PHP-way to write custom configurations. This is a way to provide contextual information inside the code, and make it available to the PHP […]