PhPHP · Lesson 1 of 8
Hello, PHP
PHP's superpower and its quirk in one: PHP files are HTML files with code embedded in <?php ?> tags. The server runs the code, the browser sees only the result.
Every variable starts with $ — love it or hate it, you always know what's a variable. Double-quoted strings interpolate variables; single-quoted strings are literal. Statements end with semicolons.
◆ Note
This embed-in-HTML model is why PHP conquered the web in the 2000s: rename page.html to page.php, sprinkle in dynamic bits, done. Modern PHP apps keep logic in pure-PHP files and use templates for HTML, but the model remains request → PHP runs → HTML out.
This embed-in-HTML model is why PHP conquered the web in the 2000s: rename page.html to page.php, sprinkle in dynamic bits, done. Modern PHP apps keep logic in pure-PHP files and use templates for HTML, but the model remains request → PHP runs → HTML out.