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 PHP developers optimize their database design to make it easier to work with date and time functions in MySQL?
PHP developers can optimize their database design by storing dates and times in MySQL using the DATETIME data type. This allows for easier manipulation and comp...
PHP database design date functions -
What is the correct way to access the uid parameter in a PHP script using $_GET?
When accessing parameters passed in the URL using the $_GET superglobal in PHP, it is important to sanitize and validate the input to prevent security vulnerabi...
PHP $_GET uid parameter -
What is the potential issue with the if statement in the PHP code provided?
The potential issue with the if statement in the PHP code provided is that the comparison operator used is assignment (=) instead of equality (== or ===). This...
if statement PHP code potential issue