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 OOP be effectively applied in PHP for managing website content based on user input?
To effectively apply OOP in PHP for managing website content based on user input, you can create classes for different content types (e.g., articles, blog posts...
Object-oriented programming PHP website content -
What is the significance of the error "unexpected T_ECHO" in PHP code?
The error "unexpected T_ECHO" in PHP code typically occurs when there is a syntax error, such as missing parentheses or semicolons, within an echo statement. To...
unexpected T_ECHO PHP code syntax error -
What are the potential pitfalls of using $HTTP_POST_VARS in PHP and why is it considered outdated in PHP5?
Using $HTTP_POST_VARS in PHP can be risky as it directly exposes data sent via POST method, making it vulnerable to security threats like SQL injection and cros...
$HTTP_POST_VARS PHP5 Superglobal