Learn to build basic programs in PHP and create dynamic web pages.
Overview
Syllabus
Introduction
- Should you learn PHP?
- A note on PHP 8.0
- Developing locally
- How PHP works
- Printing on the screen
- Using variables
- Single vs. double quotes
- What are arrays and how do they work?
- Defining arrays
- Challenge: Display basic information on an HTML page
- Solution: Display basic information on an HTML page
- Boolean operators and the truth (update for PHP 8.0)
- Logical operators
- Creating if/else statements
- Ternary operations
- Switch statements
- Match expression
- Challenge: Display content based on status
- Solution: Display content based on status
- Arithmetic operators
- Figuring out even/odd with modulus
- Incrementing and decrementing variables
- Challenge: Implementing a complicated calculation
- Solution: Implementing a complicated calculation
- What are loops?
- Do/while loops
- For loops
- Working through arrays with foreach loops
- Challenge: Calculating the Fibonacci sequence
- Solution: Calculating the Fibonacci sequence
- What are functions?
- Using built-in functions
- Writing custom functions
- Union typing variables
- Optional or named arguments
- Anonymous functions
- What are objects and classes?
- Defining a simple person class (update for PHP 8.0)
- Using the person class
- Challenge: Sort an array of objects
- Solution: Sort an array of objects
- Organizing your code
- Using include and require
- include_once and require_once
- Namespacing
- Challenge: Build a simple templating system for the provided markup
- Solution: Build a simple templating system for the provided markup
- Common debugging tools in PHP
- Types of PHP errors
- Why is my page blank?
- Common parse errors
- Common PHP errors
- Try/catch statements (update for PHP 8.0)
- Breaking changes moving from 7.x to 8.0
- GET vs. POST
- Handling basic form elements
- Handing multiple-choice elements
- Form validation: Making sure required fields are filled in
- Form validation: Appropriate input
- Form validation: Sanitizing input
- Sending the form data in an email
- Challenge: Process a simple form and send the email
- Solution: Process a simple form and send the email
- Reading files in PHP
- Writing files
- Maintaining state with cookies
- Maintaining state with sessions
- Next steps
Taught by
Joe Casabona