How-to articles, tricks, and solutions about PHP
PHP string "contains"
To check if a string contains another string in PHP, you can use the strpos() function.
How to remove line breaks (no characters!) from the string?
There are a few different ways to remove line breaks from a string in PHP. Here are two options.
How to Flatten a Multidimensional Array?
You can use array_walk_recursive() function in PHP to flatten a multidimensional array.
Passing multiple variables to another page in url
There are several ways to pass variables from one PHP page to another.
PHP form - on submit stay on same page
To stay on the same page after a form submission in PHP, you can use the following steps.
Displaying the Error Messages in Laravel after being Redirected from controller
In Laravel, you can use the withErrors method to pass error messages to a view after a redirect.
How can I handle the warning of file_get_contents() function in PHP?
The file_get_contents() function in PHP is used to read a file and return its contents as a string.
Check if $_POST exists
To check if the $_POST superglobal variable exists in PHP, you can use the isset() function.
Resetting MySQL Root Password with XAMPP on Localhost
To reset the root password for MySQL on XAMPP, you can follow these steps.
Redirect with CodeIgniter
In CodeIgniter, you can use the redirect() function to redirect the user's browser to a new page.
CURL ERROR: Recv failure: Connection reset by peer - PHP Curl
This error is usually caused by a network issue, such as a lost connection or a network timeout.
selecting unique values from a column
To select unique values from a column in PHP, you can use the array_unique function.