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 is the correct syntax for using Wordwrap with a callback function in PHP?
When using the `wordwrap` function in PHP with a callback function, the correct syntax involves passing the callback function as the fourth argument. The callba...
PHP Wordwrap callback function -
How can file permissions affect the ability to create files in PHP?
File permissions can affect the ability to create files in PHP by restricting the user's write access to the directory where the file is being created. To solve...
file permissions create files PHP -
What could be causing the error message "Unable to open 'thumbnails//tmp/phpIhGwXs' for writing" in the PHP script?
The error message "Unable to open 'thumbnails//tmp/phpIhGwXs' for writing" suggests that the script is unable to write to the specified file due to permission i...
file permissions fopen PHP error