Using objects as arrays (with a real world example) in PHP

— Sometimes, it’s convenient when you could get to access class objects as arrays. For instance, the time when one of the class properties is of type array and you want to manipulate it just like you’d do with an array without exposing it during object creation. I’ve included a real world example of where this could be useful, at the end of the article. So, read on!

Multiselect-able configuration setting in Magento2

— The other day, there was a situation where I needed to implement a multiselect configuration setting in my Magento2 application. So, I thought of documenting the process. So, the scenario was to implement a setting which enlist all the product attribute set and all those can be multiselect-able. Here’s how I did it.

Premature optimization is dangerous

— Working with PHP, it would be pretty obvious you’d be worried about the performance of your application. And because of this anxiety, you start to optimize trivial things such as replacing double quotes(“) to single quotes(‘), use echo instead of print_r, or using static methods in order to gain those little performance gains during the initial few days of your application development itself. Optimizing these thigs is good and all.