How-to articles, tricks, and solutions about PHP
Where to find composer's global packages?
Composer stores global packages in the "vendor/bin" directory within your system's home directory.
PHP cURL how to add the User Agent value OR overcome the Servers blocking cURL requests?
You can add a custom User Agent value to a cURL request in PHP using the CURLOPT_USERAGENT option.
How to add 5 minutes to current datetime on php < 5.3
You can use the strtotime function in PHP to add a certain number of minutes to a date and time.
Example of how to use bind_result vs get_result
The mysqli_stmt::bind_result() method binds variables to a prepared statement for result storage.
Delete particular word from string
In PHP, you can use the str_replace function to delete a particular word from a string.
Best way to give a variable a default value (simulate Perl ||, ||= )
The best way to give a variable a default value in PHP is to use the ternary operator ?:.
Remote file size without downloading file
In PHP, you can use the get_headers() function to retrieve the headers of a remote file.
Ignore case sensitivity when comparing strings in PHP
In PHP, you can use the strcasecmp() function to compare two strings and ignore case sensitivity.
PHP foreach with Nested Array?
To loop through a nested array in PHP using a foreach loop, you can use nested foreach loops.