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 steps can be taken to change the user from "www-data" to a specific user like "web26" in a PHP script?
To change the user from "www-data" to a specific user like "web26" in a PHP script, you can use the `posix_seteuid()` function to set the effective user ID. Thi...
PHP user change -
How can PHP developers optimize their code to prevent notices and warnings in mysqli queries?
To prevent notices and warnings in mysqli queries, PHP developers can use error suppression techniques such as the "@" symbol to suppress errors, check for erro...
PHP mysqli queries -
Are there any best practices for efficiently searching and highlighting words in PHP?
When searching and highlighting words in PHP, it is important to efficiently handle the search and highlighting process to ensure optimal performance. One way t...
searching highlighting PHP