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
-
How can syntax errors like the one in the login.php file be prevented in PHP code?
To prevent syntax errors in PHP code, it is important to carefully check for typos, missing semicolons, parentheses, and curly braces. Using an integrated devel...
syntax errors login.php PHP code -
What are the differences between using procedural and object-oriented styles for MySQL connections in PHP?
When connecting to a MySQL database in PHP, the procedural style involves using functions like `mysqli_connect` and `mysqli_query` to interact with the database...
procedural object-oriented MySQL connections -
What steps can be taken to troubleshoot and debug issues related to character encoding mismatches in PHP file name manipulation?
Character encoding mismatches in PHP file name manipulation can lead to unexpected behavior or errors when working with file names that contain special characte...
Character encoding PHP file name manipulation