Learn PHP in One Day and Learn It Well

PHP for Beginners with Hands-on Project. The only book you need to start coding in PHP immediately. By Jamie Chan

Published by: Learn Coding Fast @sitepoint June 2020

You no longer have to waste your time and money learning PHP from lengthy books, expensive online courses or fragmented PHP tutorials. This book covers all the major topics in PHP and is written in a concise and to the point manner.

About the Author: Jamie Chan

I am a tutor and freelance programmer by profession, and it is my passion to share the joy of programming with as many people as possible. My years of teaching have blessed me with the knack for turning complex programming concepts into simple terms. In my books, I take special efforts to ensure that even a complete novice to programming can understand and apply the concepts covered. Examples are carefully chosen to illustrate all concepts.

Description:

Do you want to learn PHP fast but are overwhelmed by all the information you find online? Or perhaps you have completed numerous PHP tutorials but are still unsure how everything works together. This book is for you.

You no longer have to waste your time and money learning PHP from lengthy books, expensive online courses or fragmented PHP tutorials. This book covers all the major topics in PHP and is written in a concise and to the point manner. In addition, you’ll be guided through a project at the end of the book where you get to apply the concepts learned and see how it all ties together.

The best way to learn programming is by doing. This book includes a complete project at the end of the book where you get to build a mini-blog using PHP and MySQL.

Working through the project gives you a chance to see how everything works together, including how to set up your servers, create a database, connect to it, process forms, manage security issues, handle errors and exceptions and more. Completing the project will not only give you an immense sense of achievement, it’ll also help you retain the knowledge you’ve learned and master the language.

Note that this book requires basic knowledge of HTML and SQL.

Table of Contents:

  • 1. Introduction to PHP
  • 2. Installing XAMPP
  • 3. Basic PHP Tasks
  • 4. Constants, Variables, Data Types and Operators in PHP
  • 5. More Data Types in PHP
  • 6. Control Structures in PHP
  • 7. Functions
  • 8. PHP Superglobals
  • 9. Object-Oriented Programming
  • 10. Inheritance
  • 11. Interacting with a Database
  • 12. Managing Errors and Exceptions
  • 13. Project

Chapter 1: Introduction to PHP

Thank you for picking up this book. I’m so glad you chose this book, and I sincerely hope the book can help you master PHP and introduce you to the world of dynamic web programming.

In this book, we’ll be covering most of the major topics in PHP. These topics are carefully chosen to give you a broad exposure to PHP while not overwhelming you with unnecessary details. We’ll also be building a dynamic website together at the end of the book. Excited?

Before we dive into PHP proper, note that this book requires you to have a basic understanding of HTML and MySQL.

If you are not familiar with these languages, you are encouraged to refer to my books “Learn CSS (with HTML 5) in One Day and Learn It Well” and “Learn SQL (using MySQL) in One Day and Learn it Well”.

If you are familiar, let’s move on.

1.1 What is PHP?

PHP is a general-purpose programming language used mostly for web development. Created by Rasmus Lerdorf in 1994, it allows developers to create dynamic web pages with ease.

For instance, developers can create a form in HTML and process it using PHP. Depending on the inputs entered into the form, developers can use PHP to display different outputs to users.

Most of the time, PHP is used as a server-side language. This means that PHP code is not processed on the user’s computer (also known as a client).

In other words, when you access a PHP page on your browser, the code is not processed on your computer. Instead, your browser sends a request to a web server, which then processes the code and returns the result to the browser in the form of a web page.

More often than not, this web server is a remote computer where the PHP files are stored. For the web server to process PHP code, a special software known as the PHP interpreter needs to be installed.

We’ll learn to set up our web server and install the PHP interpreter using a free software called XAMPP in the next chapter.

1.2 Why Learn PHP?

There are many reasons for learning PHP.

Firstly, PHP is one of the most widely used web programming languages and is used in many popular content management systems such as WordPress, Drupal and Joomla. As such, the demand for PHP programmers is high. If you plan on working as a freelance developer, PHP is an essential skill to have.

Next, PHP is designed to be beginner-friendly and easy to learn. In addition, due to the popularity of the language, if you run into any issues with your PHP code, you can find help easily. A simple search on the internet will likely help you resolve most of the problems you face.

Last but not least, the syntax of PHP is very similar to other programming languages such as Java or C. Once you are familiar with PHP, you’ll find it much easier to master other languages.

Ready to get started? Let’s do it!