How-to articles, tricks, and solutions about PHP
Getting the names of all files in a directory with PHP
In PHP, you can use the scandir() function to get the names of all files in a directory.
Guzzle 6: no more json() method for responses
In Guzzle 6, the json() method for parsing JSON responses has been removed.
How can I check if an array element exists?
In PHP, you can use the "in_array" function to check if an element exists in an array.
How can I detect if the user is on localhost in PHP?
You can use the $_SERVER['HTTP_HOST'] variable to detect if the user is on localhost in PHP.
How can I disable notices and warnings in PHP within the .htaccess file?
You can disable notices and warnings in PHP by adding the following line to your .htaccess file:
How can I enable the MySQLi extension in PHP 7?
To enable the MySQLi extension in PHP 7, you need to follow these steps.
How can I find the version of php that is running on a distinct domain name?
There are a few ways to find out the version of PHP running on a specific domain name.
How can I get the MAC and the IP address of a connected client in PHP?
You can use the $_SERVER['REMOTE_ADDR'] variable in PHP to get the IP address of a connected client.
How can I handle the warning of file_get_contents() function in PHP?
The file_get_contents() function in PHP is used to read a file and return its contents as a string.
How can I prevent SQL injection in PHP?
There are several ways to prevent SQL injection attacks in PHP.
How can I print all the values of an array?
In PHP, you can use a foreach loop to iterate through an array and print each value.
How can I properly URL encode a string in PHP?
To URL encode a string in PHP, you can use the urlencode function.