PHP Crash Course
June 2024, 400 pp
ISBN-13:
9781718502529
This book will take you from beginner-level to professional PHP programming, through hundreds of in-depth examples and hands-on exercises. You’ll explore best practices for developing fast, secure, and easy-to-maintain websites, while establishing a broad foundation of programming knowledge and experience.
You’ll learn how to:
- Create consistent, modern-looking web pages with easily customizable templates by combining dynamic PHP scripts, static HTML code, and Bootstrap styling
- Write server-side scripts for responding to HTTP requests, processing forms, and validating data
- Use browser sessions to implement shopping carts and user logins, and to store other user data
- Write scripts that can communicate with MySQL and other PDO databases, enabling database-driven, data-rich web applications
- Implement modern, best-practice website security, including user data sanitization, session-based logins using hashed passwords, and database prepared statements
- Save time with up-to-date, professional, open-source tools, including Composer dependency management and the Twig templating library
As you follow along, you’ll learn real-life patterns and modern programming techniques for creating, extending, and modifying web applications, all using the powerful PHP language.
Table of contents
Part 1: Fundamentals
Chapter 1: Introduction to PHP
Chapter 2: PHP Program Basics
Chapter 3: Numbers, Booleans, and NULL
Chapter 4: Working with Text Strings
Chapter 5: Making Choices
Chapter 6: Reusing Code with Functions
Part 2: Loops and Arrays
Chapter 7: Loops
Chapter 8: Simple Arrays
Chapter 9: Maps
Part 3: Websites and Form Processing
Chapter 10: Client–Server Communication
Chapter 11: PHP Websites and the Built-In PHP Server
Chapter 12: HTML Forms to Send Data
Chapter 13: Processing Form Data
Chapter 14: Validating Form Data
Chapter 15: Separating Logic and Output and Adding a Front Controller
Part 4: Sessions
Chapter 16: Working with Browser Sessions
Chapter 17: Shopping Carts
Chapter 18: Sessions for Login Authentication
Part 5: Object-Oriented PHP
Chapter 19: The Basics of Object-Oriented Programming
Chapter 20: Classes and Objects
Chapter 21: Inheritance
Chapter 22: Composer, Namespaces, and Autoloading
Chapter 23: Twig Templating
Chapter 24: Object-Oriented Web Architecture
Chapter 25: Exceptions
Chapter 26: Logging
Chapter 27: Static Members
Chapter 28: Interfaces and Traits
Chapter 29: Advanced Object-Oriented Concepts
Part 6: Databases
Chapter 30: Working with Databases
Chapter 31: Databases and Objects
Chapter 32: Improving Website Security
Chapter 33: Dates and Times
The chapters in red are included in this Early Access PDF.