PHP Superglobal Variables | Tutorial

Pubblicato il: 09 maggio 2019
sul canale di: YouAccel
17
0

Course Title: Web Development Masterclass
Course Link: http://youaccel.com/admin/cdisplay.ph...

Facebook:   / youaccel  
Twitter:   / youaccel  
Website: http://youaccel.com

Tutorial Content:

Superglobals are variables that are built into PHP and are always available for use.

You might recall that we worked with one such variable called Globals.

In this example we have a global variable (z) that stores the sum of variables x and y. We can see the global variable is accessible from outside the function, even though it is defined inside the function.

Remember that normally when a variable is declared inside a function, it is considered a local variable and cannot be accessed outside the function.

There are actually quite a number of built-in global variables, and it would take quite some time to go over each one. For this reason we have provided a couple of examples in this lesson, and included the remainder in your downloads folder.

The first here, is the $_SERVER super global. This variable stores information about headers, paths and script locations.

We can see the output in our browser, using the echo statement.

The SERVER_NAME super global returns the name of the host server. Since this script is hosted on my local machine, we see the word localhost displayed in the browser.

Other commonly used superglobals include REQUEST, POST and GET. We will be working with these in the lessons to follow.


In questa pagina del sito puoi guardare il video online PHP Superglobal Variables | Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato YouAccel 09 maggio 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 17 volte e gli è piaciuto 0 spettatori. Buona visione!