Acknowledgments . xxiii
Introduction xxv
PART I: LANGUAGE FUNDAMENTALS . 1
Chapter 1: PHP Program Basics 3
Chapter 2: Data Types . 27
Chapter 3: Strings and String Functions . 41
Chapter 4: Conditionals 65
Chapter 5: Custom Functions 81
PART II: WORKING WITH DATA . 109
Chapter 6: Loops 111
Chapter 7: Simple Arrays 125
Chapter 8: Sophisticated Arrays . 143
Chapter 9: Files and Directories 157
PART III: PROGRAMMING WEB APPLICATIONS . 175
Chapter 10: Client/Server Communication and Web Development Basics . 177
Chapter 11: Creating and Processing Web Forms . 195
Chapter 12: Validating Form Data 225
Chapter 13: Organizing a Web Application 239
PART IV: STORING USER DATA WITH BROWSER SESSIONS 259
Chapter 14: Working with Sessions 261
Chapter 15: Implementing a Shopping Cart . 275
Chapter 16: Authentication and Authorization 301
PART V: OBJECT-ORIENTED PHP . 325
Chapter 17: Introduction to Object-Oriented Programming . 327
Chapter 18: Declaring Classes and Creating Objects 337
Chapter 19: Inheritance . 357
Chapter 20: Managing Classes and Namespaces with Composer 381
Chapter 21: Efficient Template Design with Twig . 395
Chapter 22: Structuring an Object-Oriented Web Application 427
Chapter 23: Error Handling with Exceptions . 441
Chapter 24: Logging Events, Messages, and Transactions 459
Chapter 25: Static Methods, Properties, and Enumerations 475
Chapter 26: Abstract Methods, Interfaces, and Traits 497
PART VI: DATABASE-DRIVEN APPLICATION DEVELOPMENT 529
Chapter 27: Introduction to Databases 531
Chapter 28: Database Programming with the PDO Library . 541
Chapter 29: Programming CRUD Operations . 569
Chapter 30: ORM Libraries and Database Security . 595
Chapter 31: Working with Dates and Times . 631
Appendix A: Installing PHP . 663
Appendix B: Database Setup 669
Appendix C: Replit Configuration 673
Index . 679
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.