How-to articles, tricks, and solutions about PHP
To copy an image from a URL and save it to your server using PHP, you can use the following function:
Error 18 means that the transfer was closed with outstanding read data remaining.
This error typically occurs when you are trying to call a function, but you are not passing a string as the name of the function.
In PHP 5.3.0, you can use the hash function to create a SHA-256 hash.
There could be a number of reasons why a textarea element in a PHP webpage might be filled with mysterious white spaces.
It sounds like you are trying to use the Laravel session, but it is not available in the current request.
In XAMPP, the error log for PHP is typically located at {xampp-install-directory}/php/logs/php_error_log.
The error "The use statement with non-compound name" usually indicates that you are trying to use a namespace in a use statement, but you did not provide a compound name.
It is possible to use the gettext function inside a heredoc string in PHP.
To get Laravel 5's email functionality to work, you will need to configure your SMTP settings in the .env file, located in the root directory of your Laravel project.
To truncate a string in a Laravel blade template, you can use the str_limit function.
In PHP, you can call a function within the same controller by simply calling the function name followed by parentheses.
On Mac and Mac OS X, the localhost folder is located at:
It looks like you are encountering an error with the mbstring extension in PHP when using phpMyAdmin.
To remove the extension from a string in PHP, you can use the pathinfo() function and the basename() function.
In PHP >= 5.3, you can use the Object::$strictProperties property to enable or disable strict property checking for an object.
To get specific attributes from a Laravel Collection, you can use the pluck method.
To get specific attributes from a Laravel Collection, you can use the pluck method.
To calculate the distance between two coordinates in PHP, you can use the Haversine formula, which is a formula used to calculate the distance between two points on a sphere based on their longitudes and latitudes.
If you have an existing table in your database that you want to add new columns to using a Laravel migration, you can use the Schema::table method to modify the existing table.
To send email using Gmail in Laravel, you can use the built-in Swift Mailer library.
In PHP, you can use the ternary operator to perform a shorthand if-then-else statement.
To add or remove a trailing slash from the end of a URL using an .htaccess file, you can use mod_rewrite to rewrite the URL.
To include the Authorization header in a cURL POST request in PHP, you can use the CURLOPT_HTTPHEADER option and pass it an array of headers like this:
To convert column integer values into date expressions in PHP, you can use the date function.