Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to List Out All the Global variables in PHP?

Is it possible to list out all the Global Variable. Such , as to print all session variable we can use print_r($_SESSION); as the same way, if i want to know how many Global variables are define in my site. is it possible? Please Help.

I need the list which can show me all the Global variables List in PHP.

like image 386
Hemi Avatar asked Sep 19 '12 04:09

Hemi


People also ask

How can I see all global variables?

Use the env command. The env command returns a list of all global variables that have been defined. If a global variable exists in a script that hasn't been run yet, it will not show up in the output from env .

Can a global variable be a list?

A global variables list (GVL) is used to declare global variables. If a GVL is placed in the Global node of the Software catalog > Variables > Global Variables or the Applications tree, the variables will be available for the entire project.

How many global variables are there in PHP?

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

Are there global variables in PHP?

$GLOBALS is a PHP super global variable which is used to access global variables from anywhere in the PHP script (also from within functions or methods). PHP stores all global variables in an array called $GLOBALS[index].


1 Answers

Yes, PHP $GLOBALS array will show you.

<?php  echo "<pre>"; print_r($GLOBALS); echo "</pre>"; 
like image 104
Jordan Arseno Avatar answered Sep 23 '22 01:09

Jordan Arseno