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 ensure that their code is properly encoding and decoding special characters for web display?
Special characters in PHP code need to be properly encoded and decoded to ensure they are displayed correctly on the web. To achieve this, PHP developers can us...
htmlspecialchars htmlentities UTF-8 -
How can PHP's built-in SoapClient be effectively utilized for SOAP services?
To effectively utilize PHP's built-in SoapClient for SOAP services, you need to create an instance of the SoapClient class with the WSDL URL of the SOAP service...
PHP SoapClient SOAP services -
How can PHP developers ensure that file uploads are secure and prevent potential vulnerabilities in their upload scripts?
To ensure secure file uploads and prevent vulnerabilities in PHP scripts, developers should validate file types, limit file size, store files outside the web ro...
File uploads security vulnerabilities