PHP questions, answered with working code.
Search explained answers, or work through a guide from your first script to namespaces.
Popular: password_hash · PDO · sessions · array_map · json_decode
Guides
Introduction to PHP
Syntax, variables, arrays, functions, forms and basic security.
14 sections
IntermediateSessions & Cookies
Keep state between requests: creating cookies, storing and destroying session data.
9 sections
AdvancedNamespaces
Organise larger codebases, avoid name collisions and understand name resolution.
7 sections
From the knowledge base
-
What potential pitfalls should be considered when outputting binary data as an image in PHP?
When outputting binary data as an image in PHP, potential pitfalls to consider include ensuring proper content-type headers are set, handling errors that may oc...
image processing binary data PHP -
What is the purpose of the code provided in the forum thread regarding moving emails older than a certain number of weeks to the trash in PHP?
The purpose of the code provided in the forum thread is to automatically move emails older than a certain number of weeks to the trash in PHP. This can help in...
PHP email trash -
What are the potential pitfalls of not specifying all columns in an INSERT INTO statement in PHP?
If you do not specify all columns in an INSERT INTO statement in PHP, the values you provide must match the order of the columns in the table. If the order is i...
SQL injection MySQL data integrity