How-to articles, tricks, and solutions about PHP
In Laravel, you can use the unique validation rule to validate that an email address is unique when a user is updating their account.
To access the php.ini file from cPanel, you can follow these steps:
In Zend Framework, you can use the Zend_Db_Select object's __toString() method to print the exact SQL query that will be executed.
The best way to store passwords in a MySQL database is to use a one-way hashing algorithm, such as bcrypt or scrypt, to hash the password before storing it in the database.
You can use the preg_replace function in PHP to remove all non-numeric characters from a string.
In PHP, you can use the is_float() function to check if a variable is a decimal number.
This error message is indicating that the PHP function ldap_connect() is not defined or not available.
phpMyAdmin is a web-based tool for managing MySQL and MariaDB databases.
In PHP, the "Typed property must not be accessed before initialization" error is encountered when a property is defined with a type hint, but it is accessed before it has been explicitly assigned a value.
In Symfony2, you can set the class attribute of a form input by using the "attr" option in the form field configuration.
This error message indicates that the PHP script you are running is trying to use the imap_open() function, but it is not defined or not enabled in your PHP configuration.
You can use the PHP MySQLi extension to connect to a MySQL database and retrieve the data from a table to populate a drop-down box.
In PHP, you can use the is_int() function to check if a variable is an integer.
The "SMTP Error: Data not accepted" is a common error message that can occur when using the PHPMailer library to send email messages.
A common practice for generating a random token for a "forgot password" feature in PHP is to use the built-in functions random_bytes and bin2hex.
One way to block direct access to a file over HTTP but allow PHP script access is to use a .htaccess file in the same directory as the file.
This issue is likely caused by a mismatch between the character encoding used by the source of the text (e.g.
You can use the date() function in PHP to display a date in ISO 8601 format.
To clear the contents of a text file using PHP, you can use the file_put_contents() function.
The "MySQL server has gone away" error message typically indicates that the connection to the MySQL server was lost.
In PHP, you can use the $_FILES array to check the size of an uploaded file.
To display a category image in WooCommerce, you can use the woocommerce_subcategory_thumbnail hook in your theme's functions.php file.
To change the type of a field in a table using a migration in Laravel, you can use the change method on the Schema facade.
A 301 redirect in PHP using the "header" function tells the browser that the page has permanently moved to a new location.
This error message is typically related to a security feature called "Cross-Site Request Forgery" (CSRF) protection.