Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create superglobal variables in php?

Tags:

php

is there a way to create my own custom superglobal variables like $_POST and $_GET?

like image 250
Moon Avatar asked May 07 '09 12:05

Moon


People also ask

How many Superglobal variables are there in PHP?

There are about nine superglobal variables in PHP which are sometimes referred to as automatic globals .

Which Superglobal variable is an array containing the contents of $_ GET $_ POST and $_ cookies?

The $_REQUEST variable provides the contents of the $_GET , $_POST , and $_COOKIE arrays.

What is use of $_ GET [] and $_ request [] variables explain with example?

The PHP $_REQUEST is a PHP superglobal variable that is used to collect the data after submitting the HTML forms as the $_REQUEST variable is useful to read the data from the submitted HTML open forms. $_REQUEST is an associative array that by default contains contents of an $_GET, $_POST, and $_COOKIE.


1 Answers

Static class variables can be referenced globally, e.g.:

class myGlobals {     static $myVariable;  }  function a() {    print myGlobals::$myVariable;  } 
like image 141
Scott Reynen Avatar answered Sep 24 '22 03:09

Scott Reynen