How-to articles, tricks, and solutions about PHP
To enable mod_rewrite on a PHP server, you will need to make sure that the Apache mod_rewrite module is installed and enabled.
To get PHP working on Mac OS X, you can follow these steps:
You can use the array_values function to get a new array with the values of the original array, and then use the array_combine function to create an array using the new values and an indexed array of keys starting from 1:
It is generally not recommended to remove array elements while iterating over the array using a foreach loop, because the loop will behave unexpectedly when elements are removed.
In Laravel 5, you can specify a composite key on a model by defining a protected $primaryKey property on the model and setting it to an array of the column names that make up the primary key.
In PHP, you can use the "array_reduce" function to flatten a multi-dimensional array.
In PHP, you can access application parameters from a service by injecting the ParameterBag object into the service class constructor.
To access MySQL result set data with a foreach loop, you can use a loop like the following:
To access the php.ini file from cPanel, you can follow these steps:
You can use the strtotime function in PHP to add a certain number of minutes to a date and time.
To add a print button to a web page using PHP, you can use the following steps:
To add an ORDER BY clause to a query using CodeIgniter's Active Record class, you can use the order_by() method.
In this tutorial, we display and describe the most flexible ways to add elements to an empty array. Follow the steps and you will manage that easily.
You can use the following code snippet to add "http://" to the beginning of a URL if it doesn't already exist:
In PHP >= 5.3, you can use the Object::$strictProperties property to enable or disable strict property checking for an object.
Here is an example of how you can add text to an image using the PHP GD library:
To alias a table in a Laravel Eloquent query, you can use the as method on a DB facade.
While working with PHP, developers wonder how to append one array to another. This snippet is dedicated to the exploration of functions that help to do it.
In a Smarty template file, you can assign an array to a variable using the assign function.
To automatically start a download in PHP, you can use the header() function to send the appropriate headers to the browser indicating that a file download should begin.
There are several ways to benchmark the efficiency of a PHP script, including:
To build a RESTful API in PHP, you can use a framework such as Laravel or CodeIgniter, or you can build the API from scratch using core PHP.
On this page, you have an opportunity to get comprehensive information on how to calculate the difference between two dates with the help of PHP.
To call a function from a string stored in a variable in PHP, you can use the call_user_func() function.
To call a PHP script or function on a HTML button click, you can use JavaScript to send an HTTP request to the server when the button is clicked.