‫Okay.
‫So now we're going to go over super globals in PHP, which are a group of global variables that are
‫accessible from anywhere within a PHP script, including functions and classes.
‫And these variables are associative arrays that store information about the current request, the session
‫server environment, and more.
‫There's there's nine different super globals, and I'm going to go over each one really quick in this
‫video.
‫And then we'll spend individual videos going over how each one works.
‫So super globals are one of the features of PHP that actually make it really practical to work with.
‫However, they can be a source of security vulnerabilities if not used correctly, and I think that's
‫a big part of why some developers have an issue with PHP.
‫It's not that they're inherently bad, but they can be misused, and it's easy to write code that can
‫have vulnerabilities, at least with vanilla PHP.
‫I'm not talking about if you're using Laravel or anything like that, because in those cases you're
‫really not dealing directly with the super globals.
‫All right.
‫So let's just quickly go over the nine different super globals that are available.
‫Now all of these start with the dollar sign and then an underscore.
‫So it separates them from any custom variables that you might create.
‫So the first one is globals which I honestly don't use all that much.
‫What this does is it's an associative array that contains references to all the variables which are
‫currently defined in the global scope of the script, and the variable names are the keys of the associative
‫array.
‫Next we have the server Superglobal.
‫This contains information about the server, such as the file paths, the host name, and all that good
‫stuff.
‫Then we have the get superglobal, which is an associative array of variables that are passed to the
‫current script via get requests query params.
‫So if you want to send data through the URL, you can do that or through a form that has method get.
‫Then we have post which will is the same thing has an associative array of variables, but it's it's
‫variables that are passed to the current script via a Post request, usually through a form.
‫Then we have the files superglobal, which is an array of items uploaded to the current script.
‫So if you want to upload files, images and so on, then we have cookie, which is an associative array
‫of variables passed to the current script via Http cookies session.
‫So this will contain variables available to the script through sessions.
‫So when you create when you create a login system, for instance, you're going to have probably the
‫user ID stored in the session so that you can use that to, you know, to to validate and to get resources
‫of that user, etcetera.
‫Then we have the request request superglobal, which actually includes the variables from get, post
‫and cookie.
‫And it's not recommended to use requests you want to use either get post or cookie not requests.
‫It's less secure and there's really just no reason to use it over the other ones.
‫Then we have env, which is an array of variables passed to the current script via the environment method.
‫All right.
‫So I'm going to go over all of these in the coming videos.
‫So in the next video we'll start with the server Superglobal.