How to Learn PHP
PHP is a server-side (backend) programming language that is widely used. Over the years, it has evolved into a fast and powerful language for building dynamic web applications. In this article, we will explore resources and prerequisites for learning PHP.
What You Need to Know About PHP
As stated above, PHP scripts are executed on the server. It is a backend or server-side language that returns HTML to the browser. A few concepts to be familiar with before learning PHP include:
- HTML/CSS: A PHP file returns HTML to the browser and CSS styles these results.
- JavaScript: JavaScript is commonly included in PHP files for a dynamic user experience.
- PHP syntax: PHP has its own unique look and syntax. Start by getting used to reading basic PHP.
Skills Needed to Learn PHP
Having experience with the above concepts will help you get started learning PHP. Below is a list of additional skills to have in order to effectively learn PHP:
- Experience in another programming language: Despite having a unique syntax, PHP uses the same concepts as other languages. These concepts include loops, functions, and conditional statements to name a few. Having skills in this area will allow you to efficiently add PHP to your programming toolkit.
- Familiarity with databases: PHP is a server-side language that interacts with a variety of database systems. Proficiency with a popular one such as MySQL or PostgreSQL is necessary.
- Understand Object-Oriented Programming (OOP): Like other OOP languages, PHP uses classes and objects to create a program hierarchy.
Why You Should Learn PHP
PHP has attracted some controversy since its invention in 1994. That said, there have been major updates to the language, including the addition of the Laravel framework. These updates have solved a lot of the issues surrounding previous controversies.
Below is a list of reasons to learn PHP:
- Widely used: It powers over 80% of websites today. PHP has grown alongside modern frameworks, so it is here to stay.
- Scalable: Some of the largest websites use PHP. In addition to being stable and scalable, PHP flattens the learning curve with the updates mentioned above.
- Powerful: As a server-side language, PHP handles requests reliably, quickly, and with stability.
How Long Does it Take to Learn PHP?
As will be discussed below, there are many resources to learn PHP. Each resource will take a different amount of time to complete. That said, you can expect to be proficient in PHP in a few weeks to a month.
Learning PHP: A Study Guide
There are many ways to learn PHP. Below is a mix of online courses, books, and tutorials:
Learn PHP by codecademy
- Resource type: Online course
- Pricing: From $19.99 per month
- Audience: Beginner
This fundamental building course consists of 25 hours of instruction where you’ll learn the basics, such as data types and functions. You’ll also learn how to submit a form and handle form validation. The only suggested prerequisite is some basic HTML knowledge.
PHP Tutorial by W3Schools
- Resource type: Tutorial
- Pricing: Free
- Audience: Beginner to advanced
W3Schools has built a massive tutorial that spans tasks like writing a beginning script or making AJAX requests. This resource is a great way to learn how PHP works without spending a penny.
Object Oriented PHP and MVC by Brad Traversy
- Resource type: Online course
- Pricing: From $17.99
- Audience: Intermediate
This course on Udemy is a six-hour-and-40-minute crash course in Object-Oriented PHP programming. It covers object-oriented PHP concepts in the context of building a MVC project. Basic knowledge of PHP and programming is recommended.
Learning PHP by David Sklar
- Resource type: Book
- Pricing: From $16.94
- Audience: Beginner
In Learning PHP by David Sklar, you’ll be introduced to programming concepts such as arrays, functions, and form validation. Each chapter contains exercises and explanations to help you go deeper. After the fundamentals are introduced, Sklar also teaches intermediate concepts such as API access and package management.
Learning PHP, MySQL, and JavaScript by Robin Nixon
- Resource type: Book
- Pricing: From $20.98
- Audience: Intermediate
Taking a full-stack approach, Nixon teaches how to use PHP with a MySQL database. Later, the author dives into front end functionality with JavaScript and jQuery. Familiarity with HTML/CSS and programming concepts is recommended.
Communities for People Studying PHP
PHP Community
This active community offers discussions on PHP in their forum as well as through their Twitter hashtag. The forum is user-friendly and easy to navigate. The community is also tightly moderated, so feel free to start a friendly discussion.
PHP on Dev.to
Dev.to has taken a more instructional approach. Here, you’ll find discussions, code snippets, and tutorials. At the time of writing, there are quite a few Laravel tutorials.
PHP Forum
The PHP Forum is organized into discussion topics that range from code and PHP jobs to general discussions. There are sections devoted to MySQL and some to HTML basics. PHP Forum is well organized and covers a wide variety of topics.
How Hard is it to Learn PHP?
With several updates over the years, the learning curve for PHP has flattened. This is because it has grown alongside other modern languages such as Ruby and Python. These updates have made PHP more accessible to learn.
PHP is not any more difficult to learn than other modern server-side languages; with plenty of resources to learn and communities to support you, assistance is readily available.
Will Learning PHP Help Me Find a Job?
PHP is still an in-demand and growing language. With over 80% of modern websites using it, the need for PHP developers won’t go away anytime soon.
- Salaries: According to Glassdoor, the median base salary for a PHP developer is $76,136 annually. Keep in mind this is an average, so some companies may offer $60,000 for entry positions.
- Job Openings: According to Indeed.com, there are currently 7,052 job openings for PHP developers.
- Industry Growth: The US Bureau of Statistics projects a 15% growth in jobs in the field of web development, including PHP developers, by 2026. This is more than double the growth of most other sectors.
Conclusion: Is PHP Still Viable?
You’ll encounter this question when researching PHP. As briefly mentioned above, there were some controversial conventions implemented in the early days. Nowadays, these issues have been resolved and PHP continues to evolve.
Despite what you read on some message boards, PHP is still viable. There are stats to back this claim: with an ever-increasing demand for developers and the fact that it powers 80% of websites, PHP will be around for years to come.