PHP 7.4+ Error: Typed property must not be accessed before initialization

IssueIn PHP 7.4.6, I use the newly introduced property type hints, like this:<?phpclass Test{ pri...
Jun 14, 2021 PHP Comments 0

PHP: Insert an element with the specified key at the beginning of the array

IssueWith array_unshift(), we can prepend one or more elements to the beginning of an array. All num...
May 15, 2021 PHP Comments 0

Reads the content of a text file line by line in PHP

Here are several ways to read a text file line by line in PHP. Suppose there is a text file which co...
Mar 17, 2021 PHP Comments 0

Invoke call_user_func_array error: expected to be a reference, value given

IssueUse the call_user_func_array method to call a callback, and pass parameters by reference. The c...
Feb 16, 2021 PHP Comments 0

Get file name without file extension in PHP

This article introduces two ways to get file name without file extension in PHP.1. Using regular exp...
Dec 29, 2020 PHP Comments 0

Get text between <tag> and </tag> with PREG in PHP

When we make a simple web crawler in PHP, we often need to extract HTML tags. We can use some third ...
Sep 01, 2020 PHP Comments 0

PHP 7.4 configure: error: The pkg-config script could not be found or is too old

IssueIn Linux and Mac Os, I compile the source code of PHP 7.4.9. Run the following commands.$ ./con...
Aug 24, 2020 PHP Comments 0

PHP 5 Configure error in Mac: Undefined symbols for architecture x86_64: "_libiconv", referenced

IssueIn Mac OS, I compile the source code of PHP 5, include 5.4.45/5.5.38/5.6.40. Run the following ...
Aug 08, 2020 PHP Comments 0

Handle large file downloads in PHP

In order to handle file download, we need to response several HTTP headers and write a file to the o...
Aug 06, 2020 PHP Comments 0

Support download with resume in PHP

RequirementIn web application, we often need to provide file downloads. For small files, there is no...
Aug 04, 2020 PHP Comments 0