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!