Lesson 2 / 25
Install PHP and run a file
Explain Install PHP and run a file, run a small example, and check the result.
The essential idea
Install PHP and run a file is easiest when you first identify its job. Name the input, the change, and the result before memorising syntax. Small explicit steps make programs easier to repair later.
Run a tiny experiment
This idea is one part of the path from a source file to useful output.
<?php
echo "Namaste, PHP!\n";
Output:
Namaste, PHP!
A common trap
Do not trust code just because it looks familiar. For Install PHP and run a file, change one value, run the smallest example, and compare the result with your prediction.
Quick check
Quick check: What is the best first practice for Install PHP and run a file?
- Run one small, focused example.
- Memorize syntax without testing it.
- Ignore error messages.
Answer
Run one small, focused example. — A small experiment gives direct feedback about cause and effect.