How-to articles, tricks, and solutions about PHP
Declaration of Methods should be Compatible with Parent Methods in PHP
In PHP, when a class inherits from another class, it is said to be a subclass or derived class.
Delete particular word from string
In PHP, you can use the str_replace function to delete a particular word from a string.
Detecting request type in PHP (GET, POST, PUT or DELETE)
In PHP, you can use the $_SERVER['REQUEST_METHOD'] superglobal to detect the request type.
Difference between require, include, require_once and include_once?
In PHP, require and include are two statements that are used to include a file in a PHP script.
Disabling Strict Standards in PHP 5.4
To disable strict standards in PHP 5.4, you can add the following line of code to your PHP script:
Display an array in a readable/hierarchical format
Here is an example of how you could display an array in a readable/hierarchical format in PHP:
Displaying the Error Messages in Laravel after being Redirected from controller
In Laravel, you can use the withErrors method to pass error messages to a view after a redirect.
Divide integer and get integer value
In PHP, you can divide two integers using the forward slash (/) operator.
Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning
When building a Docker image with PHP and the zip extension, you may see the warning.
Does file_get_contents() have a timeout setting?
Yes, the file_get_contents function in PHP does have a timeout setting.
Doing HTTP requests FROM Laravel to an external API
To make an HTTP request from Laravel to an external API, you can use the HTTP client of your choice.
Efficiency of using foreach loops to clear a PHP array's values
Using a foreach loop to clear the values of an array in PHP is an efficient way to do so.