From First Script to Full Website—Fast!

Tired of cobbling together PHP solutions from scattered online tutorials? Frustrated by outdated PHP practices that leave your code vulnerable and hard to maintain? Whether you’re building your first dynamic website or modernizing legacy systems, PHP Crash Course gives you a complete, practical foundation for writing professional web applications.

In this comprehensive, example-driven guide, you’ll learn how to:
  • Write clean, maintainable PHP code using modern language features and best practices
  • Build secure web applications that protect against common vulnerabilities
  • Master database integration using PDO and object-relational mappings (ORMs)
  • Implement professional features like shopping carts and user authentication
  • Structure applications using object-oriented programming and model-view-controller (MVC) patterns
  • Leverage powerful tools like Composer and Twig to accelerate development

Starting with PHP fundamentals, you’ll progress through six carefully crafted sections covering essential patterns, security best practices, database integration, and advanced concepts like object-oriented programming. Each chapter builds on real-world examples, giving you the skills to solve common development challenges.

Whether you’re a complete beginner or an experienced developer looking to modernize your PHP skills, PHP Crash Course gives you everything you need to build professional, dynamic websites with confidence.

Includes setup instructions for Windows, macOS, and Linux, and configuration details for Replit, the free online development environment.
Acknowledgments
Introduction

PART I: LANGUAGE FUNDAMENTALS
Chapter 1: PHP Program Basics
Chapter 2: Data Types
Chapter 3: Strings and String Functions
Chapter 4: Making Choices with Conditionals
Chapter 5: Creating Reusable Code with Functions

PART II: WORKING WITH DATA
Chapter 6: Repeating Actions with Loops
Chapter 7: Simple Arrays
Chapter 8: Sophisticated Arrays
Chapter 9: Working with Files and Directories

PART III: PROGRAMMING WEB APPLICATIONS
Chapter 10: Client-Server Communication and Web Development Basics
Chapter 11: Creating and Processing Web Forms
Chapter 12: Validating Form Data
Chapter 13: Organizing a Web Application

PART IV: STORING USER DATA WITH BROWSER SESSIONS
Chapter 14: Working with Sessions
Chapter 15: Implementing a Shopping Cart
Chapter 16: Authentication and Authorization

PART V: OBJECT-ORIENTED PHP
Chapter 17: Introduction to Object-Oriented Programming
Chapter 18: Declaring Classes and Creating Objects
Chapter 19: Inheritance
Chapter 20: Managing Classes and Namespaces with Composer
Chapter 21: Efficient Template Design with Twig
Chapter 22: Structuring an Object-Oriented Web Application
Chapter 23: Error Handling with Exceptions
Chapter 24: Logging Events, Messages, and Transactions
Chapter 25: Static Methods, Properties, and Enumerations
Chapter 26: Abstract Methods, Interfaces, and Traits

PART VI: DATABASE-DRIVEN APPLICATION DEVELOPMENT
Chapter 27: Introduction to Databases
Chapter 28: Database Programming with the PDO Library
Chapter 29: Programming CRUD Operations
Chapter 30: ORM Libraries and Database Security
Chapter 31: Working with Dates and Times

Appendix A: Installing PHP
Appendix B: Database Setup
Appendix C: Replit Configuration
Dr. Matt Smith is a senior lecturer in computing at Technological University Dublin, specializing in web applications and immersive technologies. With over 30 years of teaching experience and degrees from the University of Huddersfield (BA), the University of Aberdeen (MSc), and the Open University (PhD), he has been at the forefront of PHP-based web development education since the mid-2000s.

About

From First Script to Full Website—Fast!

Tired of cobbling together PHP solutions from scattered online tutorials? Frustrated by outdated PHP practices that leave your code vulnerable and hard to maintain? Whether you’re building your first dynamic website or modernizing legacy systems, PHP Crash Course gives you a complete, practical foundation for writing professional web applications.

In this comprehensive, example-driven guide, you’ll learn how to:
  • Write clean, maintainable PHP code using modern language features and best practices
  • Build secure web applications that protect against common vulnerabilities
  • Master database integration using PDO and object-relational mappings (ORMs)
  • Implement professional features like shopping carts and user authentication
  • Structure applications using object-oriented programming and model-view-controller (MVC) patterns
  • Leverage powerful tools like Composer and Twig to accelerate development

Starting with PHP fundamentals, you’ll progress through six carefully crafted sections covering essential patterns, security best practices, database integration, and advanced concepts like object-oriented programming. Each chapter builds on real-world examples, giving you the skills to solve common development challenges.

Whether you’re a complete beginner or an experienced developer looking to modernize your PHP skills, PHP Crash Course gives you everything you need to build professional, dynamic websites with confidence.

Includes setup instructions for Windows, macOS, and Linux, and configuration details for Replit, the free online development environment.

Table of Contents

Acknowledgments
Introduction

PART I: LANGUAGE FUNDAMENTALS
Chapter 1: PHP Program Basics
Chapter 2: Data Types
Chapter 3: Strings and String Functions
Chapter 4: Making Choices with Conditionals
Chapter 5: Creating Reusable Code with Functions

PART II: WORKING WITH DATA
Chapter 6: Repeating Actions with Loops
Chapter 7: Simple Arrays
Chapter 8: Sophisticated Arrays
Chapter 9: Working with Files and Directories

PART III: PROGRAMMING WEB APPLICATIONS
Chapter 10: Client-Server Communication and Web Development Basics
Chapter 11: Creating and Processing Web Forms
Chapter 12: Validating Form Data
Chapter 13: Organizing a Web Application

PART IV: STORING USER DATA WITH BROWSER SESSIONS
Chapter 14: Working with Sessions
Chapter 15: Implementing a Shopping Cart
Chapter 16: Authentication and Authorization

PART V: OBJECT-ORIENTED PHP
Chapter 17: Introduction to Object-Oriented Programming
Chapter 18: Declaring Classes and Creating Objects
Chapter 19: Inheritance
Chapter 20: Managing Classes and Namespaces with Composer
Chapter 21: Efficient Template Design with Twig
Chapter 22: Structuring an Object-Oriented Web Application
Chapter 23: Error Handling with Exceptions
Chapter 24: Logging Events, Messages, and Transactions
Chapter 25: Static Methods, Properties, and Enumerations
Chapter 26: Abstract Methods, Interfaces, and Traits

PART VI: DATABASE-DRIVEN APPLICATION DEVELOPMENT
Chapter 27: Introduction to Databases
Chapter 28: Database Programming with the PDO Library
Chapter 29: Programming CRUD Operations
Chapter 30: ORM Libraries and Database Security
Chapter 31: Working with Dates and Times

Appendix A: Installing PHP
Appendix B: Database Setup
Appendix C: Replit Configuration

Author

Dr. Matt Smith is a senior lecturer in computing at Technological University Dublin, specializing in web applications and immersive technologies. With over 30 years of teaching experience and degrees from the University of Huddersfield (BA), the University of Aberdeen (MSc), and the Open University (PhD), he has been at the forefront of PHP-based web development education since the mid-2000s.

Books for National Depression Education and Awareness Month

For National Depression Education and Awareness Month in October, we are sharing a collection of titles that educates and informs on depression, including personal stories from those who have experienced depression and topics that range from causes and symptoms of depression to how to develop coping mechanisms to battle depression.

Read more

Horror Titles for the Halloween Season

In celebration of the Halloween season, we are sharing horror books that are aligned with the themes of the holiday: the sometimes unknown and scary creatures and witches. From classic ghost stories and popular novels that are celebrated today, in literature courses and beyond, to contemporary stories about the monsters that hide in the dark, our list

Read more

Books for LGBTQIA+ History Month

For LGBTQIA+ History Month in October, we’re celebrating the shared history of individuals within the community and the importance of the activists who have fought for their rights and the rights of others. We acknowledge the varying and diverse experiences within the LGBTQIA+ community that have shaped history and have led the way for those

Read more