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
-
Are there any potential pitfalls to be aware of when using custom fonts in PHP?
When using custom fonts in PHP, one potential pitfall to be aware of is ensuring that the font file path is correctly specified. If the path is incorrect, the f...
custom fonts PHP web development -
How can PHP be used to sort an HTML table by day of the week?
To sort an HTML table by day of the week using PHP, you can first extract the day of the week from the date in each row of the table. Then, you can use a sortin...
PHP HTML table sorting -
What are the best practices for handling data aggregation and display in PHP when dealing with multiple related tables?
When dealing with multiple related tables in PHP, it is best practice to use SQL JOIN statements to aggregate data from different tables and then display the re...
SQL joins data normalization PHP arrays