back to course
Lesson 04 / 1952%· free preview
Introduction to PHP4/9
Client-Side vs Server-Side Scripting
Where does the code run?
| Client-side (JavaScript) | Server-side (PHP) | |
|---|---|---|
| Runs on | The visitor's browser | Your web server |
| User can see source | Yes — View Source | No — only the HTML output |
| Access to DB | No (must go via API) | Yes — direct MySQL/Postgres |
| Access to files | No (sandboxed) | Yes — read/write any file the server can |
| Reacts to user input | Instantly (no network) | Needs a request to the server |
| Examples | clicks, form validation, animations | login, save to DB, send email, generate PDFs |
Why both exist
Modern websites mix the two: PHP handles the "what" (data, auth, DB) while JavaScript handles the "how it feels" (clicks, animations, fetch). You can't replace PHP with JavaScript when you need a database or secret API key — the user could read them.
textBrowser ←—HTML/CSS/JS—— Server (PHP) ←—SQL—— Database ↑ secret keys business logic user passwords
AI-powered recap
Quick recap quiz?
We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.
Ready to move on?
// feedback.matters()
Did this lesson help you?
