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 does call_user_func_array work in the context of binding parameters in PHP?
When using `call_user_func_array` in PHP to call a function with parameters, you can pass an array of parameters as the second argument. To bind parameters to a...
call_user_func_array binding parameters PHP -
How can PHP beginners effectively debug issues related to XML parsing and node attribute access in their code?
To effectively debug XML parsing and node attribute access issues in PHP, beginners can use functions like `simplexml_load_string()` to parse XML data and `attr...
PHP XML parsing node attribute access -
How can PHP be used to validate user credentials before redirecting to a secure page?
To validate user credentials before redirecting to a secure page, you can create a PHP script that checks the entered username and password against a database o...
PHP user credentials validation