yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

PHP Explanation


6m read
·Nov 3, 2024

Hey guys, this is Matt. Kids, And1. This is going to be a, um, a four five minute video. I hope, um, if it's not, um, don't correct me, um, on what exactly PHP is.

Now, I think we did a brief video on this before, but, um, I just want to, um, um, explain this to you guys. And John, the other guy in mids, no one doesn't seem to exactly understand it either, so, um, I hope you all understand PHP after watching this video.

Now, first of all, um, if you own a website, like, um, we own maidsand1.com, and you pay extra for PHP support, that means that that website is PHP compatible. So, if you make your HTML files PHP, the website will still work, but you might have to fix some of your links. But, um, the website will still work.

Now, PHP um, is almost nothing like CSS. It's not like HTML in any way, really. PHP um, has nothing to do with, um, um, the design of the website. Um, what happens on your browser when you go to a PHP file is, um, the PHP file just sends you HTML, and all you're seeing in your browser is HTML, even though, um, the PHP file ran its stuff.

So, let me just explain this. If you, on a website, on your browser, go to a PHP file, making your request for a PHP file on the web server, the web server then executes the PHP file before it sends you the, um, actual file. It executes the PHP file, the PHP file returns HTML code, and then the server sends you the HTML code.

So basically, when it's just an HTML file, your computer, and you go to like google.com, which is HTML, it sends a request to the server. Then the server finds that file, reads it, and sends you the contents of that file, and then your browser reads those contents of that file and displays the web page that is generated from those contents of that file.

Um, with PHP, your browser never actually gets sent the PHP file from the server. The server sends it HTML that a PHP program returns. So, um, basically this is kind of complicated. PHP, um, a PHP file, let me just show you in Taco HTML, edit this.

This is an HTML file right here, and right now, if I save this as HTML, your browser would see all this. Say PHP is going to be right here. Um, if you write question mark PHP and then close from this point to this point, if you just leave this right here, their browser will not see this part, this PHP, and then the question mark thing.

So, um, if right here I said Echo Pi in my PHP file, then uploaded it to my server, so that way if they go to, um, say mac1.com and then the name of this PHP file, they wouldn't see this part. They all they would see would be high. This is what they'd see. This PHP code would make them see the word high.

So PHP functions, anything the PHP does, runs on the server. Then the server decides what to do with it, whether to send it to your browser or whatever, that's if it's configured for PHP.

So basically, um, you cannot view PHP source code on a server, um, no matter what, unless they have some funky permissions thing set up. Pretty much if they're configured to always read PHP files, execute them, and then send you.

So I could have 500 lines of PHP code that deletes files on the server, makes files, changes passwords, does all this stuff, but I could just have this nothing return except for the word high, and all your browser would see would be the word high. It wouldn't see anything else, which is why PHP, like JavaScript and HTML, the features of those are built into your browser because your browser is what handles the HTML file, but PHP functions are handled by the server.

So macon1.com is hosted by a computer somewhere. It's a computer somewhere that's hosting it, and that computer has all the PHP stuff built into it, not your computer. Your computer has no control over what the PHP does, um, which is, um, an interesting thing.

So basically, that's why youtube.com, you can read through all their source code you want, but you can't, um, basically figure out where the file that they store all the passwords is or all the hashed passwords that they probably hash, which would be secure.

Um, so basically, um, if you take a look at this PDF I made, um, I'll just open it up. It's kind of simple. This is the diagram, of course, PHP. This is just a short explanation.

Okay, file reading. Basically, PHP can read files and return them to you in several ways. So our website, I will just tell you this before I read through these, um, our website, let me just go to it, okay, we built this in PHP.

So you'll notice that this will say this in the HTML code when you view the source; it'll just be the code for this if you haven't logged in. But if you have logged in, I'll just log in as maads101. If you're logged in, it'll say this in the HTML code. That's because we made it with PHP.

Another cool thing I'll point out that you can only do with PHP and ASP and stuff that's not HTML, you might be able to do this with stylesheets as well, but this is useful, is that this bar on the side is a separate file. This bar on the right is a separate file.

So that way we can have one file that's all the advertisement for all the pages. Then the PHP script, instead of echoing all the code for this, it reads the file and then spits out the contents of the file. So you get the contents of the file in your web browser. Same thing goes for this right thing except we have multiple ones for the different pages there.

And I'll just prove this too by going to mac.com ads with two ds. HTM, and this is actually the advertisements bar. Of course, this isn't hooked up with the stylesheet, so it doesn't look quite as good as the other one did. Um, but that's the code.

So, um, PHP basically, I’ve showed you it's, um, it runs on the server, and you don't have any power over what it does from your computer without some FTP password or anything like that.

So you can't view our PHP source code; it's just impossible unless we go open source, um, which is why, um, PHP, like I said, is used for YouTube and, and secure stuff like that.

Also, ASP is something like PHP except Microsoft had something to do with it, so I don't like ASP.

Um, so basically, um, here are a few things that I'm going to try to answer. Can PHP read my files? This means, um, on your own physical computer when you go to a website that has some PHP code on it or a PHP file and it returns HTML. Can PHP read your files? No, PHP is never physically on your computer, so the PHP code has never ever been on your computer.

So there's no way it can touch your computer in any way. It can read the files on the server like it can read the index file on our website, but it can't read your files.

Okay, why does a PHP page sometimes take some so long to load? Um, while a PHP script runs on the server, your browser will say loading and, um, your browser has no idea when it'll be done loading because you don't know when the PHP thing will be done executing.

Um, so if I have a PHP script that just waits 10 seconds, then gives you a webpage, it'll take 10 seconds to load. Can PHP get my request information? This means, like, if you go to, um, maads101.com, not only are you sending, um, a request for the index page, it can, um, you're also sending the packet that has your remote IP address, your outgoing port number, and the browser that you use.

Well, PHP can see a lot of information about your request, like your browser you use, your remote IP, and outgoing port number. Um, we actually, I actually have a good example of this on my website, um, and you can get it on maadsone's website as well, it's maids.com pages info.php, and um, this tells you some information like your remote IP address, the browser that it can suck out of it about your, um, the information it can suck out of your request for your browser and the outgoing board number, which you change pretty much every time.

So it can, um, tell what browser you use, and that's actually good because our website doesn't work on Internet Explorer. So we're going to soon be making it so if you go to midsand1.com in Internet Explorer, it'll ask you if you're sure you want to go, and it might not look the best.

So, um, that’s that’s something about PHP. Can I see someone else's PHP source code? No, PHP is file stored on the server. You can't read the file without FTP, SSH, or some other weird permission set on the PHP file.

And there are also other ways to read this if they've set up some magic thing. Um, when you try to download the PHP file through whatever program you use to download stuff, it'll download the result of the PHP file. Um, so there's no real way to read our PHP source code.

Okay, so thank you, and um, have a nice day. So that is PHP for you. Um, so I hope you really understand PHP a little bit better now. Um, so, um, thank you for watching maads One, subscribe, and goodbye.

More Articles

View All
Using probability to make fair decisions
We’re told that Roberto and Jocelyn decide to roll a pair of fair six-sided dice to determine who has to dust their apartment. If the sum is seven, then Roberto will dust. If the sum is 10 or 11, then Jocelyn will dust. If the sum is anything else, they’l…
We WILL Fix Climate Change!
Our home is burning. Rapid climate change is destabilizing our world. It seems our emissions will not fall quickly enough to avoid runaway warming, and we may soon hit tipping points that will lead to the collapse of ecosystems and our civilization. While…
Social Welfare Does Not Kill Business, with President of Iceland Ólafur Grímsson | Big Think
If you look at the Nordic countries, Finland, Sweden, Norway, Denmark, Iceland, you have five countries; they are all different in many ways, but there is one very strong common factor: these five countries all have very competitive free market economies.…
How to Help Small Businesses During COVID-19 | Ask Mr. Wonderful #22 Kevin O'Leary & Maria Sharapova
I Mr. Wonderful here, and welcome to another episode of Ask Mr. Wonderful. Now, you know what I love to do time to time is to invite a guest onto the show to help me answer all of your questions. I’m always amazed by how many questions we get and where we…
Why No One Has Measured The Speed Of Light
This video was sponsored by KiwiCo. More about KiwiCo at the end of the show. I know what you’re thinking. - Clickbait! - No one has measured the speed of light, that’s ridiculous. The speed of light is exactly 299,792,458 meters per second. We are so s…
Documenting Democracy | Podcast | Overheard at National Geographic
Lots of tear gas, lots of rubber bullets, and I think I lived with garlic and onions in my pockets for like several months because that’s one common way to kind of get rid of the effects of tear gas. People would just hand those to you to help you out whe…