How-to articles, tricks, and solutions about PHP
PHP - Check if two arrays are equal
You can use the array_diff() function to check if two arrays are equal.
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 to replace "if" statement with a ternary operator ( ? : )?
Here's how you can replace an "if" statement with a ternary operator in PHP.
Laravel Eloquent Sum of relation's column
You can use the sum method on an Eloquent relation to get the sum of a column's values.
Upgrading PHP in XAMPP for Windows?
To upgrade PHP in XAMPP for Windows, you will need to follow these steps.
How to locate the php.ini file (xampp)
The location of the php.ini file depends on how you installed XAMPP.
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.
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 to get last key in an array?
You can use the end() function to get the last element of an array in PHP.
Truncate a string to first n characters of a string and add three dots if any characters are removed
How to convert a string to JSON object in PHP
You can use the json_decode function in PHP to convert a JSON string into a PHP object.
Where is the php.ini file on a Linux/CentOS PC?
On a CentOS system, the php.ini file is usually located in the /etc directory.
How can I remove part of a string in PHP?
There are several ways to remove a portion of a string in PHP.