PHP Basics

Why PHP?

Maximiliano Firtman

Maximiliano Firtman

Independent Consultant
PHP Basics

Check out a free preview of the full PHP Basics course

The "Why PHP?" Lesson is part of the full, PHP Basics course featured in this preview video. Here's what you'd learn in this lesson:

Maximiliano explains that 76% of websites use PHP. While several websites use WordPress, the most popular content management system, companies like Meta, Microsoft, and Wikipedia still have PHP as part of their infrastructure. This presents a large opportunity for future PHP developers.

Preview
Close

Transcript from the "Why PHP?" Lesson

[00:00:00]
>> Maximiliano Firtman: So PHP is a widely-used open-source scripting language, we'll go back to that later, especially to it for web development and can be embedded into HTML. Also, you can see how HTML appears here, KS, something part of the definition. By way, this definition is coming from Wikipedia, I didn't write it.

[00:00:20]
But actually it's in a scripting language for web development. Typically we are talking about server-side and it can be embedded into HTML. This is probably the most important number that you will see today, PHP is used by 76% of all the websites whose server-side perming language we know, 76, okay?

[00:00:48]
That's a huge number, and I'm pretty sure that if you ask young developers about this, they will say it's 1%, right? Because the feeling that we have on the web is that no one is using PHP anymore, but it's actually the opposite. So, of course there is a catch here, or several catches, so we can try to narrow this number.

[00:01:13]
First, when you look at large websites or, the top Alexa 100 websites versus the long tail, we see a difference there. So, we have more PHP penetration on the long tail, like smaller websites than on the bigger startups. On the startup side, on the large scale websites, or, I know, banks.

[00:01:40]
Social Networks, PHP usage is lower than on the long tail, blogs, small e-commerce websites and so on, so it's not calibrated there. But anyway, there are still a lot of large websites powered by PHP including most of the Meta websites, Facebook and some parts of Instagram. Wikipedia is based on PHP, and of course they are large website in terms of users, the use base and of course what they're doing.

[00:02:16]
We'll talk about what Facebook has done in the past in a few minutes, okay? So PHP currently powers Facebook, as I mentioned, many parts of the Microsoft website is actually PHP-based, Wikipedia, and probably the 40% of that 76% is actually WordPress. So WordPress is the most used CMS content management system out there, and it's based on PHP, which also the number 76% not actually a lie, but it's a data that we need to get some granular information.

[00:02:58]
So for example, that doesn't mean that 76% of the web developers are using PHP, because there are a lot of WordPress websites out there that are based on PHP, but actually the owner, the developer of that website, never brought any PHP line code. So they're just using WordPress, and WordPress is based on PHP, okay?

[00:03:19]
But If you're a developer and you need to maintain WordPress websites, at some point, you need to get into PHP. You need to create a theme, you need to create the plugin, you need to touch the WordPress code or add something on top of that, and for that you need PHP, so that's why we are covering today, PHP fundamentals.

[00:03:44]
There's no show WordPress, Drupal, Joomla, and many others out there using PHP, and also now going back to the developer perspective, Magento, symphony, Laravel, code igniter. Those are frameworks for developers that are using PHP behind the scenes, actually, you write PHP to use those frameworks. And of course, there are a lot of jobs out there for Laravel, CodeIgniter, and so on.

[00:04:16]
Maybe for vanilla PHP, so PHP without any framework, in terms of jobs, might not be like the best scenario, but you do have a lot of framework based things. So let's say that these frameworks are kind of Express js or Django or similar that for PHP, okay? So they let you do their frameworks on top of PHP to make server-side web development easier.

[00:04:49]
Today, we will just cover the fundamentals and we will do everything from scratch manually, like with vanilla PHP, so no frameworks, no libraries, okay? This is interesting because most people think that PHP is for the web, but actually PHP can be used for chat scripting, so you can do scripting your computer.

[00:05:11]
What is scripting, whatever, you script for whatever you wanna do instead of using Node or a JavaScript or Go or Pearl Python, you can use PHP to do something every morning in your computer. Clean up some data, do a backup so you can run PHP scripts completely separated from the web.

[00:05:34]
Of course, that being on the back end on a web server is 99.9% of the usage of PHP these days, okay? And there is also some other, I actually, during my career, I found, I think, two or three companies actually using this third option that we have here, desktop applications with PHP.

[00:05:55]
I'm not sure if I've ever heard about that, but I got the three companies companies doing that. There is a kind of a framework that is not official, but it's kind of part of the official things you can do. It's PHP-JTK, where you can create desktop applications, so forget about the web.

[00:06:20]
Desktop applications with Windows, like with PHP, multiplatform, by the way, Windows, Mac, Linux. So you create Windows, buttons, of course, it looks like from the nineties meaning even the image you see there, the website in general looks like from the nineties because it's coming from the nineties. At that time it was kind of another way, an alternative way, to create multi-platform desktop applications, compared with Java.

[00:06:44]
After that, .NET appear, but .NET wasn't originally completely multi-platform, so it was a way to create desktop app. You can still make some quick, short desktop applications with PHP using this framework. But yeah, it's not what we are expecting, and also these days, we have some crazy ideas.

[00:07:06]
So this is actually, I wanna show you this directly in action. This is PHP, well, it has a retro UI, okay, but this is a playground to play with this. This is PHP client-side in the browser. So instead of writing JavaScript, you write PHP and it runs client-side, okay?

[00:07:35]
It's called phpwasm, it's actually a WebAssembly interpreter of PHP that runs in the browser, mobile devices, desktop devices. So it's an experiment, okay, but no one is using it in production, but you can even talk to the DOM. So there are some demos here you can try, so DOM access, for example, load.

[00:07:57]
So here you can see, this is PHP, we'll see the code later, but is the PHP changing some or executing some code from PHP, okay? Again, it's just an experiment, but there are people that still experimenting with PHP and see what else can we do with PHP. Also there is another experiment that will let you compile, PHP code into a web assembly module.

[00:08:22]
By the way, I'm not sure if all of you know what web assembly is, but it's a way that we have in the browser this day, client side, on every browser to execute kind of a compiled code. So we can compile some code from some language, it can be C, it can be code, it can be codling, types script, there are a lot of languages.

[00:08:41]
You compile into a binary code and then you can execute that binary code from JavaScript client side. Well, there is one compiler for PHP, so you write PHP, you compile that PHP and then JavaScript can execute that PHP code.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now