How-to articles, tricks, and solutions about PHP
In CodeIgniter, you can rename a file on upload by using the do_upload() method of the Upload class.
In PHP, you can use the preg_match() function to extract the string value of an HTML tag.
In PHP, you can use the DateTime class to create a new date and time object from a string.
In Laravel, you can create a new folder using the File facade's makeDirectory method.
To check if a given username and password match those stored in a MySQL database, you can use a SQL SELECT statement with a WHERE clause.
The require_once function in PHP is used to include a specific PHP file in another file, but it will only include the file once to prevent multiple declarations.
This error message is indicating that there is an issue with an entity reference in the HTML code being parsed by the DOMDocument class.
To remove a package with Composer, you can use the command composer remove [package-name].
To properly log out of a session in PHP, you can use the session_destroy() function.
In CodeIgniter, you can get the value of the id from the URL by using the function $this->uri->segment(n), where n is the position of the segment you want to retrieve.
You can use the strtotime() function in PHP to convert a Unix timestamp to the beginning and end of that day.
In PHP, you can use the explode() function to split a string into an array, where each element of the array is a substring that was separated by a specified delimiter.
In PHP, you can use the $_SERVER['HTTPS'] variable to check whether the current page is being served over HTTPS.
In PHP, you can set the value of a public class variable by using the assignment operator (=) after the variable name.
To log out a user from HTTP authentication using PHP, you can use the header function to send a "WWW-Authenticate" header with a value of "Basic realm=realmName" and a 401 status code.
This error message is indicating that there is a problem connecting to the MySQL server.
To make an HTTP request using the file_get_contents function in PHP and retrieve the response code, you can use the following code snippet:
The Haversine formula is a mathematical formula that can be used to calculate the great-circle distance between two points on a sphere, such as the Earth.
To use the PHP that Homebrew installed, you will first need to make sure that it is in your system's PATH.
In PHP, you can use the substr() function to check if a string starts with a specific character or substring.
This error message in Laravel 5 typically means that you are trying to instantiate an interface, but interfaces cannot be instantiated because they are only a contract for the methods that a class should implement.
It is possible to invoke a PHP script from a MySQL trigger by using the system() function in the trigger's body.
This error message is indicating that the PHP script, "artisan," is attempting to run a database migration command, but the database server is denying access to the user "laravel" on the "localhost" location.
Yes, you can add a confirm button before running a delete routine on a website using PHP.
In PHP, you can use the array_map() function to search and replace values in an array.