How-to articles, tricks, and solutions about PHP
To install the PHP 7 MongoDB driver, you can use the PECL (PHP Extension Community Library) command-line tool.
To change the global path for Composer on Windows, you will need to update the system environment variables.
You can use the $_SERVER['HTTP_HOST'] variable to detect if the user is on localhost in PHP.
You can use the PHP function readfile() to read the contents of a Word document and then use the appropriate headers to prompt the browser to open or download the file.
There are a few different ways to extract text within parentheses in PHP, depending on the specific requirements of your use case.
In PHP, you can use the array_unique function to check if all values in an array are the same.
There are several possible reasons why cURL is returning a 0 length response when trying to connect to an HTTPS site.
This can occur if your PHP code is using the ISO-8859-1 character set instead of UTF-8.
In PHP, you can use the built-in function array_filter() to filter the array by a specific property's value.
To automatically log out a user after 15 minutes of inactivity in PHP, you can use the session mechanism provided by PHP.
Here is an example of how you can add text to an image using the PHP GD library:
To run a PHP function from an HTML form, you will need to create an HTML form with the desired inputs, such as text fields and submit buttons.
You can use the preg_replace() function in PHP to convert plain text URLs into HTML hyperlinks.
file_put_contents is a PHP function that writes a string to a file.
In PHP, you can match whitespace, carriage return, and line feed using the following regular expression:
The file_exists() function in PHP can be used to check if a file exists on the file system.
PSR-4 is a standard for autoloading classes in PHP.
The error message "Cannot modify header information - headers already sent" typically occurs when a PHP script attempts to send a cookie or redirect the user's browser to a different page, but some output has already been sent to the browser.
There are several reasons why the Laravel storage link may not be working on production.
One way to make a countdown using PHP is to use the time() function, which returns the current timestamp, and subtract a future timestamp (representing the end date and time of the countdown) from it.
In SQL Server, you can convert a varchar value to an integer or decimal value using the CAST or CONVERT function.
To see the actual XML generated by the PHP SOAP Client class, you can use the __getLastRequest() method.
To create an array from a foreach loop in PHP, you can use the array push function array_push() inside the loop.
In PHP7, nullable return types were introduced, allowing a function to return either a specific type or null.
In PHP, you can divide two integers using the forward slash (/) operator.