Introduction to PHP

⭐️ 👀 2023 WEB DEVELOPMENT BOOTCAMP starting in days! Join the waiting list to reserve your spot in my 10-weeks cohort course and learn the fundamentals, HTML, CSS, JS, Tailwind, React, Next.js and much much more! 👀 ⭐️

PHP is an incredibly popular programming language.

Statistics say it’s used by 80% of all websites. It’s the language used by WordPress, the widely used content management system for websites.

And it powers a lot of different frameworks that make Web Development easier, like Laravel. Speaking of Laravel, that might be the one reason to learn PHP these days.

PHP is a very polarizing language. Some people love it, some people hate it. If we move one step above the emotions and we look at the language as a tool, PHP has a lot to offer.

Sure it’s not perfect. But let me tell you no language is perfect.

In this new series I’m going to help you learn PHP.

I’ll explain modern PHP, version 8+.

PHP has evolved a lot in the last few years and if the last time you tried it was PHP 5 or even PHP 4, you’d be surprised at all the good things that PHP now offers.

Let’s go!

PHP is a programming language mostly used to create Web Applications.

As a language, it had a humble beginning. It was first created in 1994 by Rasmus Lerdorf to create his personal website. He didn’t know at the time it would eventually become one of the most popular programming languages in the world. It became popular later on, in 1997/8, and exploded in the 2000s when PHP 4 landed.

PHP can be used to add little interactivity to an HTML page.

Or it can be used as a Web Application engine that creates HTML pages dynamically and sends them to the browser.

It can scale to millions of page views.

Did you know Facebook is powered by PHP? Ever heard of Wikipedia? Slack? Etsy?

Let’s get into some technical jargon.

Programming languages are divided into groups depending on their characteristics. For example interpreted/compiled, strongly/loosely typed, dynamically/statically typed.

PHP is often called a “scripting language” and it’s an interpreted language. If you’ve used compiled languages like C or Go or Swift, the main difference is that you don’t need to compile a PHP program before you run it.

Those languages are compiled and the compiler generates an executable program that you then run. It’s a 2-steps process.

The PHP interpreter is responsible for interpreting the instructions written in a PHP program when it’s executed. It’s just one step. You tell the interpreter to run the program. A completely different workflow.

PHP is a dynamically typed language. The types of variables are checked at runtime, rather than before the code is executed as it happens for statically typed languages (which also happen to be compiled, the two characteristics often go hand in hand).

PHP is also loosely (weakly) typed. Compared to strongly typed languages like Swift, Go, C or Java, you don’t need to declare the types of your variables.

Being interpreted and loosely/dynamically typed will make bugs harder to find before they happen at runtime. Often the compiled can be a great help to anticipate possible problems. But on the other hand, an interpreted language has more flexibility.

Fun fact: PHP is written, internally, in C, a compiled and statically typed language.

In its nature, PHP is similar to JavaScript, another dynamically typed, loosely typed and interpreted language.

PHP supports object-oriented programming, and also functional programming. You can use it as you prefer.

In the next few weeks we’ll explore all the important concepts of PHP.

Stay tuned.

One more thing! ⚠️ ✋

At the end of January I will organize the Web Development Bootcamp.

It's a 10-weeks long cohort online course where I will guide you to becoming a Web Developer.

It's not "just a course". It's a big event I organize once a year.

We'll start from zero, learn the fundamentals of Web Development, HTML CSS, JavaScript, Tailwind, Git, using the command line, VS Code, GitHub, Node.js, we'll then learn React, JSX, how to use PostgreSQL, Astro, Next.js, Prisma, deploying on Netlify/DigitalOcean/Fly/Vercel and much more! 

At the end of the first 10 weeks you'll know how to create web sites and web applications and I'll unlock you the 2nd phase of the Bootcamp: you will get access to a large number of projects exclusive to the Bootcamp graduates, so you can follow my instructions to build things like private areas with authentication, clones of popular sites like Twitter YouTube Reddit, create e-commerce sites, and much much more.

Because once you got the fundamentals, you only learn by working on real, exciting projects.

To find out more, visit bootcamp.dev