Week 11: PHP Basics & Forms
PHP | Variables, Arrays, Functions, Forms, Sessions, OOP
Al-Aqsa University
PHP Basics & Forms
Server-side programming, variables, control flow, functions, arrays, forms, sessions, cookies, and OOP
Week 11
What is PHP
Setup
Syntax
Variables
Data Types
Operators
Strings
Conditionals
Loops
Arrays
Functions
Include/Require
Forms
Validation
File Handling
Sessions
Cookies
OOP
1. What is PHP? Server-Side Language
PHP: Hypertext Preprocessor
PHP is a server-side scripting language designed for web development. Unlike HTML, CSS, and JavaScript which run in the browser (client-side), PHP runs on the web server. The server processes the PHP code and sends the resulting HTML to the browser.
- Created by: Rasmus Lerdorf in 1994
- Current version: PHP 8.x
- Used by: WordPress, Facebook, Wikipedia, Laravel, Drupal
- File extension: .php
- PHP is free, open-source, and runs on all major operating systems
- PHP can generate dynamic HTML, interact with databases, handle file uploads, manage sessions, and more
How PHP Works: Client-Server Model
[Browser / Client] [Web Server (Apache/Nginx)]
================== ===========================
1. User visits 2. Server receives request
http://localhost/index.php ------> and finds index.php
4. Browser receives HTML 3. PHP engine processes
and renders the page