When we are working with loops, we sometimes need to check first if the variables are iterable. Otherwise, we get the warning message “Warning: Invalid argument supplier for foreach()” in PHP. We get this warning when we use variables are
Start Up Laravel Application by Running Roadrunner
Are you doubting the potential performance of the PHP application you’ve been building with Laravel Framework? As an interpreted language, PHP is slow. Factor in the apparent out-of-the-box slowness that we could attribute to the framework; your application could be
Laravel 8 PHP Configuration For Local Development Environment
Yesterday, I wrote about how to enable PostgreSQL drive in PHP 7.4. Today, I noticed Laravel 8 is already available. So, I have decided to migrate to Laravel 8 from Laravel 7. This short post shows how to configure some
PHP 7.4 – Enable PostgreSQL Driver
This post shows how to configure PHP 7.4 (or PHP 7.x, in general) php.ini to enable the PostgreSQL driver, which comes in handy when I need to work on a new version of PHP after a very long break (like
How to use the PHP Countable Interface
Background This article demonstrates how to implement and use the Countable interface in PHP. The Countable interface is normally used in conjunction with other interfaces (i.e., Iterator, ArrayAccess, etc.) to create data structures like PHP SPL Library’s SplDoublyLinkedList and SplStack.
Using Composer from Java Developer’s Perspective
Background Composer is a dependency manager for PHP. It makes your life easy. If you are a Java developer and have used Apache Maven, you’ll find Composer a familiar tool. Unlike Maven, dependencies are declared in a file called composer.json
Constructors in PHP 5+
This article demonstrates how constructors work in PHP. It will also touch on destructors just briefly. If you’re a Java programmer who has somehow become bored with anything Java and wanted to explore PHP, the first thing you need to realize is OOP in PHP is slightly different. Take for instance, constructors.
Return class’ Canonical Name in PHP
Background [wp_ad_camp_1] There are times you need to refer to a class by a string representing its fully qualified class name. For example in Laravel 4.2, you may specify a route to a controller by hard-coding the fully qualified class
How to use phpfastcache to Cache Data to Files
Background [wp_ad_camp_5] Most of the PHP Frameworks I worked on or experimented with have their own ways of caching things to reduce calls to other systems (e.g., RDBMS) or interfaces to plug in third-party caching libraries. But what if you
How to Read and Write XML Documents using PHP DOM Extension
Background With XML Parser, you use can only read XML. To write and otherwise manipulate an XML document, you can use PHP DOM Extension. DOM stands for Document Object Model and it is a way of expressing XML nodes as