An ordered set of instructions. It reads input, follows rules, and produces output.
Workspace
PHP
web backends CMS and server rendered pages
Definition first
What PHP means
PHP is a programming language for writing exact instructions, often used for web backends CMS and server rendered pages. Start with one mental model: input goes through steps and becomes output.
index.phpRun php index.phpHabit Keep input validation close to request handlingA value is data. A variable is the name you use to hold and reuse that data.
A named piece of work. It takes input, does one job, and can return a result.
PHP CLI or web server is the place that actually runs code from index.php.
First readable code
Variables
dollar variables echo arrays<?php $name = "Ada"; echo $name;
Output AdaLanguage lineage
PHP family tree
See where PHP comes from, which languages feel close, and what to learn next.
server rendered websites, CMS work, forms, and practical web backends
Zero base path
Question bank
Search before practice
Pick a stage or search across the open programming bank. Jump straight to the matching drill.
PHP practice 1
PHP question 1. Choose the statement that matches variable.
PHP practice 2
PHP question 2. Choose the statement that matches echo.
PHP practice 3
PHP question 3. Choose the statement that matches function.
PHP practice 4
PHP question 4. Choose the statement that matches foreach.
PHP practice 5
PHP question 5. Choose the statement that matches variable.
PHP practice 6
PHP question 6. Choose the statement that matches echo.
PHP practice 7
PHP question 7. Choose the statement that matches function.
PHP practice 8
PHP question 8. Choose the statement that matches foreach.
PHP practice 9
PHP question 9. Choose the statement that matches variable.
PHP practice 10
PHP question 10. Choose the statement that matches echo.
PHP practice 11
PHP question 11. Choose the statement that matches function.
PHP practice 12
PHP question 12. Choose the statement that matches foreach.
PHP practice 13
PHP question 13. Choose the statement that matches variable.
PHP practice 14
PHP question 14. Choose the statement that matches echo.
PHP practice 15
PHP question 15. Choose the statement that matches function.
PHP practice 16
PHP question 16. Choose the statement that matches foreach.
PHP practice 17
PHP question 17. Choose the statement that matches variable.
PHP practice 18
PHP question 18. Choose the statement that matches echo.
Multiple choice
PHP practice 1
PHP question 1. Choose the statement that matches variable.
$name = "Ada";
Reference
Patterns for index.php
php index.phpdollar variables echo arrays
Variables
<?php $name = "Ada"; echo $name;
- Variables start with dollar sign
- echo outputs text
- End statements with semicolons
function parameters return
Functions
function add($a, $b) {
return $a + $b;
}- Use function for reusable work
- Validate input
- Return values
indexed associative foreach
Arrays
$user = ["name" => "Ada"]; echo $user["name"];
- Associative arrays use keys
- foreach loops through arrays
- Escape output in HTML