How to use count() within a loop in PHP? Put it outside

In order to make your code cleaner, the best way is to use the count() function outside of the loop. See the example below: What it count() in PHP? The count() function is a built-in function in PHP that we use to count the number of elements in an array. We can also use it […]

How to use isset() with multiple variables

There is a smart way of using the isset() function in PHP when dealing with several variables. The old-fashioned way: The easiest and smart way to use isset() with multiple variables:

How to fix “trying to get property of non-object” with PHP8 in Laravel

If you’re tired of the error “trying to get property of non-object”, you could use an optional helper method in Laravel. Also, if you’re using PHP8+ you could find the better way of dealing with these issues with the nullsafe operator. Here we go: You can read the official PHP reference on this operator here […]