3. display_errors
• Do not use display_errors in Production (Live Site)
• Use error_log instead to write errors to a file
• Trick for using on scripts with parse errors:
error_reporting(E_ALL);
ini_set("display_errors", 1);
include 'file_with_error.php';
4. Spelling Errors
Use consistent capitalization
• PHP Class names: Capitalized
• PHP Variable & Object names: camelCase
• PHP Constants: UPPERCASE
• MySQL Tables & Fields: lowercase_with_underscores
7. Unbalanced Curly Braces
Unexpected $end
Unexpected }
• These types of parse errors occur when you have
extra curly braces, missing curly braces, or ones
in the wrong places.
• Format your code with standard indenting is more
readable and makes spotting these errors easier.
8. Headers Already Sent
Warning: Cannot modify header information -
headers already sent
<?php
// The extra space causes an error.
header('Location: http://test.com');