PHP Quotes and Apostrophes – the Difference
Learn the difference between single quotes and double quotes in PHP, when each is evaluated, and why apostrophes are the faster default for strings.
Learn the difference between single quotes and double quotes in PHP, when each is evaluated, and why apostrophes are the faster default for strings.
Why you should always follow a PHP header() redirect with die() or exit(), so code after the redirect does not keep running for the user.
Practical advice on taking regular backups of your code, websites and databases, plus common backup pitfalls like never testing your restores.
How to fix the MySQL error Incorrect usage of UNION and ORDER BY by wrapping each SELECT statement in parentheses when you order data sets.
How the PHP modulo operator works and how to use it to highlight every nth item in a loop, with examples for pagination and progress feedback.
How to import large MySQL SQL dump files without phpMyAdmin timeouts, using the free BigDump script to split and import the file automatically.
An .htaccess rule that redirects non-www URLs to www to avoid duplicate content, written so it works on any site without editing the code.
How the PHP ternary operator shortens simple if and else statements into one readable line, with examples and advice on when not to use it.
Practical thoughts on writing good code comments: keep them short, make them readable, update them, use TODO notes, and add useful links.
A note for 1and1 hosting users: server logs are deleted after three months, so download the access.log files regularly to keep your statistics.