Getting Started With PHP: FAQs

At the time of writing, PHP is used on the server side of approximately 80% of the websites today. That’s a lot of PHP! Although PHP is over 20 years old, it’s still a cornerstone of web development, and we thought it made sense to answer some questions we frequently hear about this widely used language.

Why should I learn PHP in 2017?

Created in 1995, PHP has a long and thorough history as a tried and true scripting language.

  • Getting a job: Because so much of the web is built on PHP, many jobs are available for PHP developers to build and maintain servers.
  • Popularity: Large content management systems like Wordpress use PHP. Popular websites like Wikipedia and Facebook also use PHP in parts of their web servers.
  • Community: PHP has a huge community of people behind it. If you’re just starting to learn a new programming language, PHP has plenty of support to help solve almost any problem you may run into. Forums, meetups, and plenty of guides have been created and curated to help newbies and experts alike.

Is PHP a good first programming language?

We hear this question a lot! While there’s technically no best first programming language, one of our instructors, Sergio Cruz, remembers starting out using PHP when he had no prior programming knowledge.

Getting PHP set up was super easy to jump in and get started. I had heard of languages like Java, but didn’t really know what you could do with them. With PHP, I was able to download it and get started right away building my first website back in middle school. I built a ‘Hello World’ application that afternoon.

What do I need to know to get started learning PHP?

  • The basics: We recommend starting with the syntax and control structures of the PHP language and getting a text editor like Atom to start typing code locally. These are the building blocks of learning more advanced PHP. Our Try PHP course on Code School covers syntax and things like loops and conditional statements.
  • PHP: The Right Way: Once you’ve got basic syntax down, we recommend checking out PHP: The Right Way. It breaks down how to solve problems with PHP, the basics of setting up a web server, and how to access databases. All of the information is open source and continually updated.
  • Modern PHP: After you’ve got a grasp on how PHP looks and feels and have some experience building small applications, check out a book called Modern PHP by Josh Lockhart. Josh covers what new PHP applications should look like and builds upon PHP: The Right Way by bringing it into an up-to-date guide.

What can PHP be used for these days?

PHP is a server-side scripting language, meaning that if you understand the basics of requests and responses from a server, you can use PHP to fill that role! When a server receives a request for data, it has to process the request before it can send back an answer. As a scripting language, PHP can manage these types of requests, as well as interacting with APIs, requesting data from a database, and taking data from JSON files.

Most commonly, PHP is used to process requests made by web browsers to send website data back and forth.

To see some of these processes in action, it’s possible to set up a mock PHP server locally and try to pass data back and forth.

PHP standards and recommendations

If you work with PHP long enough, it’s almost inevitable that you’ll share your code with a team member or need to review it at a later date. A group called PHP-FIG maintains a “Standards Recommendations” page on their website that keeps an up-to-date log of all the PHP standards you should adhere to when building your applications. Following these standards can help you write maintainable code and create a “level playing field” for other developers to step in and understand what’s going on within your PHP.

What is the best PHP framework?

While we hesitate to give an opinion about a best framework, we’ll give some clarity around some of the more popular options out there.

Laravel: Laravel is a full-stack PHP framework. It’s been around since 2011 (relatively new to the PHP world), but has consistently been ranked among the most popular PHP frameworks out there. It has a large ecosystem of tools, tutorials, and community to support it, making it easy to jump right in. Laravel has more self-proclaimed “syntactic sugar” than many other frameworks, making it a popular place to start with PHP frameworks.

Symfony: Symfony is similar to Laravel in many ways and makes it easy to get started creating web applications. It integrates well with front-end frameworks like Angular and third-party applications, making connecting and using APIs a breeze.

Slim: Although not as popular as Symfony or Laravel, Slim is worth mentioning. Slim is a micro-framework that focuses on APIs. “Micro” is the key word in the framework description, as it largely stays out of the way and makes it easy to get up and running to create APIs quickly. It has very few dependencies.

What questions do you have about using PHP? If you’ve used PHP for a while, what experiences would you like to share?

Code School is an online learning platform for existing and aspiring developers to learn technologies like HTML/CSS, JavaScript, Ruby on Rails, PHP, and more.