
Learn PHP
Learn and Master Interactive Web Design with PHP
What you'll learn
- Learn the PHP language and prepare the work environment
- Understand the basics of programming
- Use conditional statements and loop statements
- Split a program into functions
- Work with arrays and text
- Work with forms and files
- Handle programming errors
- Use Sessions and Cookies
- Apply object-oriented programming
- Work with databases and XML
About this course
This course teaches the PHP language. It is a free, open-source programming language and one of the best-known languages for programming interactive websites, and it supports databases, above all MySQL. You start with the course introduction and preparing the tools and work environment, then the basics of programming, conditional statements and loop statements with practical examples. After that you learn to split a program into functions, and to work with arrays, text, forms and files, and to handle programming errors. Then you move on to Sessions and Cookies, object-oriented programming, databases, and finally PHP and XML. This course suits anyone who wants to learn to build dynamic websites, whether you are a complete beginner or a programmer in another language. You need no previous experience with PHP, because the lessons start from installing the tools and move forward with practice. The course is divided into many short lectures, so you learn each topic on its own and practice it yourself. By the end you will be able to write PHP programs, work with forms, files and databases, and build an interactive website with many features.
Expected outcomes
- Master PHP for developing dynamic web sites and applications.
- Ability to create advanced programming solutions using databases and forms.
- Understand object-oriented programming (OOP) and apply it in projects.
- Handle texts, arrays, and files to enhance user experience.
- Design integrated systems using PHP and databases.
Learner reviews
Course content
1Tools and Work Environment
5 lectures
- Course HighlightsGives an overview of the course content, from setting up the environment with a web server and an IDE, to variables, control flow, loops, functions, arrays, forms, files, error handling and object-oriented programming.7:08
- Course IntroductionAn introduction to the PHP course contents and how it progresses from the basics to advanced levels, covering variables, taking input, control statements, loops, strings, regular expressions and forms.8:03
- Tools and Work Environment (1)Explains using MySQL Workbench to work with the database server, applying statements with the Apply button, modifying table columns such as dropping a column, and inserting data.17:13
- Tools and Work Environment (2)Explains installing the requirements for running PHP: XAMPP, which provides Apache, MySQL and FileZilla, and the NetBeans IDE, then setting the PHP path in NetBeans via Tools and Options.20:43
- Tools and Work Environment (3)Finishes setting up the work environment: configuring the Global Include path in NetBeans, the folder from which PHP files run on XAMPP, and running a file to confirm the setup works.8:51
2Programming Basics
2 lectures
- Programming Basics (1)Starts PHP language syntax: writing code, printing text and comments, then the variable as temporary storage for values, data types inferred automatically from the value, and constants defined with define.27:31
- Programming Basics (2)Explains shorthand assignment operators such as += instead of writing the full expression, then builds an example with an HTML form using POST and a submit button, reviewing data types and constants.24:00
3Conditional Statements
3 lectures
- Conditional Building Commands (1)Explains conditional control statements in PHP, namely if and else, by testing a score entered by the user in a form and printing a different result depending on whether it is above fifty.14:25
- Conditional Building Commands (2)Continues PHP conditional statements: checking that the user pressed the button before running code, using if and elseif to classify grades, then an example calculating tax by income brackets.20:39
- Conditional Building Commands (3)Explains the switch case statement as an alternative to chained if and elseif, using case and break to pick one of several cases, and converting the earlier example to this form.14:59
4Looping Statements
3 lectures
- Looping Commands (1)Explains loops in PHP, especially the for loop, by printing a value several times, changing the counter and step, counting down, and summing values inside a loop before printing the total.12:37
- Looping Commands (2)Explains nested for loops with two counters, i and j, how they print rows and columns to build a multiplication table, and using a condition inside the loop to mark specific cases.10:08
- Looping Commands (3)Explains the do while loop compared with while, where the first runs at least once, condition-based repetition, and the continue statement to skip an item and go back to the loop.15:14
5Practical Examples
2 lectures
- Practical Examples (1)A review of previous PHP lessons through practical examples: telling even from odd numbers, a multiplication table, computing a factorial and reversing a string, with a start on swapping.27:48
- Practical Examples (2)Practical examples: swapping the values of two variables using a third one, summing numbers with a loop, and programmatically computing the area of a triangle and a rectangle.18:05
6Dividing the Program into Functions
5 lectures
- Dividing the Program into Functions (1)Explains creating functions in PHP: defining a function and calling it, then functions with parameters, such as one that adds two numbers and shows the result through another printing function.20:33
- Dividing the Program into Functions (2)Continues PHP functions: functions with parameters and return values, moving functions into a separate file and including it for reuse, with an example computing a total and a percentage.27:15
- Dividing the Program into Functions (3)Continues functions: placing functions in a separate file and including it with the right path, then default parameter values used when no argument is passed in the call.9:25
- Dividing the Program into Functions (4)Explains passing arguments to functions by value and by reference and the difference between them, then functions that accept a variable number of arguments instead of defining one function per count.11:12
- Dividing the Program into Functions (5)Explains functions with an unspecified number of arguments, then recursive functions that call themselves, applying it to computing a factorial with a stopping condition.18:32
7Handling Arrays
3 lectures
- Dealing with Arrays (1)Explains arrays: defining an array, accessing its elements by index starting at zero, filling it with a loop, and an example comparing an entered password against the array elements.25:11
- Dealing with Arrays (2)Continues arrays: initial values, looping with for, printing in reverse order, comparing with user input, then two-dimensional arrays using two nested loops.12:35
- Dealing with Arrays (3)Explains built-in array functions such as count to count elements, sort to order them and array_reverse to reverse them, showing the array before and after sorting.8:43
8Text Handling Programmatically
2 lectures
- Dealing with Texts Programmatically (1)Explains working with strings in PHP through functions such as printf, converting a number to a character by its ASCII code, trimming extra spaces, splitting text, and the max function.22:43
- Dealing with Texts Programmatically (2)Explains the date function and its formats, then regular expressions to match a value against a pattern, building a custom pattern, and an email validation example.17:55
9Handling Forms
3 lectures
- Dealing with Models (1)Explains handling forms in PHP: designing a form with name and email fields, sending its data to a PHP file, and the difference between the GET and POST submission methods.21:47
- Working with Models (2)Designs an HTML form with text, email, website and textarea fields, sets the handling file in action and the method, mentioning the MVC pattern and separating code into its own file.18:15
- Working with Models (3)Explains receiving form data in the handler file set in action, the difference between GET and POST, and a calculator example with add, subtract, multiply and divide buttons.13:13
10File Handling
2 lectures
- Dealing with Files (1)Explains file handling in PHP: checking that a file exists, opening it and reading its content, writing to it and appending, reading it line by line, and copying and deleting it.28:14
- Dealing with Files (2)Explains reading from and writing to files, specifying the file path, showing its content in a text box, and trying it with a data file saved from Excel.18:15
11Handling Programming Errors
2 lectures
- Dealing with Programming Errors (1)Explains error handling in PHP: the three error types, syntax, logic and run time, the division by zero example, and the difference between checking with if and the proper try and catch approach.13:34
- Dealing with Programming Errors (2)Explains error handling with try, catch and finally blocks, using a function that inverts a number and throws an exception on division by zero, which catch handles so the program continues.4:02
12Sessions and Cookies
3 lectures
- Sessions and Cookies (1)Explains sessions in PHP as temporary global variables that carry across web application pages, such as keeping the user name after login, with starting a session, storing a value, a visit counter and removing the variable.13:08
- Sessions and Cookies (2)Builds a login screen using sessions: calling session_start, storing the username, and having the welcome page block visitors who have not logged in and redirect them to the login page.15:23
- Sessions and Cookies (3)Explains cookies in PHP and how they resemble sessions: creating a cookie, checking it with isset, printing all cookies, and deleting a cookie by expiring it.13:54
13Object-Oriented Programming (OOP)
8 lectures
- Goal-Oriented Programming (1)Explains object-oriented programming in PHP: grouping functions inside a class to organize code, then creating an object from the class and calling its functions, with an example function that adds two values.14:08
- Goal-Oriented Programming (2)Builds a Rectangle class with variables and functions for area and perimeter, includes it from another file, and shows that each object created from the class has its own values.18:45
- Goal-Oriented Programming (3)Explains the constructor, which runs automatically when an object is created to set initial values, including constructor parameters, and the destructor, which runs at the end.18:37
- Goal-Oriented Programming (4)Explains access modifiers public and private, making a variable private and exposing it through set and get functions so the class designer controls the allowed values.18:05
- Goal-Oriented Programming (5)Explains inheritance between classes, where a subclass inherits the contents of its superclass, the protected modifier, and applying it with a Person class and an Employee class.20:03
- Goal-Oriented Programming (6)Applies inheritance in practice with a Person class and subclasses such as Employee and Customer using extends, with set and get functions, and redefining functions in the subclass.15:10
- Goal-Oriented Programming (7)Explains overriding functions in a subclass, the final keyword that prevents overriding or extending, and the static keyword for calling functions through the class name.15:13
- Goal-Oriented Programming (8)Explains the abstract class and abstract methods with no body that subclasses implement, the fact that no object can be created from it, with a recap of constructor, static and final.8:12
14Database
6 lectures
- Databases (1)Introduction to the second book of the Android applications series: an overview of what it covers, including working with databases, two buttons to save and display data, moving the app to a mobile phone, and apps such as audio and sending email.20:55
- Databases (2)Explains working with databases from PHP through SQL statements, namely insert, delete, update and select, and the steps to connect to a MySQL database before running them.15:52
- Databases (3)5:15
- Databases (4)Explains the steps for working with a database from PHP: connecting, writing the SQL statement and executing it, with select and insert examples on a students table.18:54
- Databases (5)Explains displaying one specific record instead of all records, fixing the comparison of a value whose type differs from an integer, and taking the record id from the user instead of hardcoding it.8:02
- Database FundamentalsBuilds a page interface for the students table with save, delete and update buttons, wiring each button to an insert, delete or update statement on the database through PHP.23:22
15PHP and XML
1 lectures
- PHP and XMLExplains XML as a markup language with tags like HTML, the need for a single root tag wrapping the other elements, then loading an XML file in PHP and displaying its records.19:33
Instructor

Eng. Azab Mohamed Azab
This course is part of the diploma




