Turning Learners Into Developers
Codekilla
CODEKILLA
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 onThe visitor's browserYour web server
User can see sourceYes — View SourceNo — only the HTML output
Access to DBNo (must go via API)Yes — direct MySQL/Postgres
Access to filesNo (sandboxed)Yes — read/write any file the server can
Reacts to user inputInstantly (no network)Needs a request to the server
Examplesclicks, form validation, animationslogin, 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.

text
Browser  ←—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?