473,396 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

List all declared variables

I don't really need to do this, but I was wondering. Is there some way
of obtaining a list of all the variables that have been declared in a
PHP script ?

Ie. for globals you have $_GLOBAL, is there something that would let you
know the name of all variables that have been declared?

Ta.
Apr 11 '07 #1
3 12548
On Apr 11, 5:38 pm, Tyno Gendo <you@localhostwrote:
I don't really need to do this, but I was wondering. Is there some way
of obtaining a list of all the variables that have been declared in a
PHP script ?

Ie. for globals you have $_GLOBAL, is there something that would let you
know the name of all variables that have been declared?

Ta.
get_defined_vars

(PHP 4 >= 4.0.4, PHP 5)

get_defined_vars - Returns an array of all defined variables
Description
array get_defined_vars ( void )

This function returns a multidimensional array containing a list of
all defined variables, be them environment, server or user-defined
variables, within the scope that get_defined_vars() is called.

Apr 11 '07 #2
mi***********@gmail.com wrote:
On Apr 11, 5:38 pm, Tyno Gendo <you@localhostwrote:
>I don't really need to do this, but I was wondering. Is there some way
of obtaining a list of all the variables that have been declared in a
PHP script ?

Ie. for globals you have $_GLOBAL, is there something that would let you
know the name of all variables that have been declared?

Ta.

get_defined_vars

(PHP 4 >= 4.0.4, PHP 5)

get_defined_vars - Returns an array of all defined variables
Description
array get_defined_vars ( void )

This function returns a multidimensional array containing a list of
all defined variables, be them environment, server or user-defined
variables, within the scope that get_defined_vars() is called.
Interesting. And a function for getting defined functions and
classes... nice. As I say, don't actually need to use them at the
moment but that's good to know they are there!

So many functions, I should randomly read through the manual and ponder
over what's there :-)
Apr 11 '07 #3
On Apr 11, 4:58 pm, Tyno Gendo <you@localhostwrote:
Interesting. And a function for getting defined functions and
classes... nice. As I say, don't actually need to use them at the
moment but that's good to know they are there!

So many functions, I should randomly read through the manual and ponder
over what's there :-)
That would be get_declared_classes and get_defined_functions.

You should really start reading the manual completely ;)

Cheers
Martin
------------------------------------------------
online accounting on bash bases
Online Einnahmen-Ausgaben-Rechnung
http://www.ea-geier.at
------------------------------------------------
m2m server software gmbh
http://www.m2m.at

Apr 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: James Monroe | last post by:
1st off... I am not talking about session, application, form, or server variables.. Does any one know of an asp script or program than can analyze a ".asp" page and report back all of the...
11
by: C++fan | last post by:
Suppose that I define the following class: class example_class{ public: example_class(); void funtion_1(); void function_2(); protected:
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
9
by: Don | last post by:
Say I have a class like so: Public Class MyClass Public Prop1 as Integer Public Prop2 As Integer Public Prop3 As Integer End Class Is it possible to retrieve a list of the variables or...
15
by: Bit byte | last post by:
I am writing a small parser object. I need to store keywords etc in lsts. Because this data is to be shared by all instances of my parser class, I have declared the variable as class variables...
16
by: Jonathan.Fillion | last post by:
Ok, I have a simple problem and I might just be blind and not see the (possibly simple) solution to it. I want to declare variables while adding them to a list simultaneously. What I want to do is...
5
by: Y2J | last post by:
I am working through this book on C++ programming, the author is speaking of using linked lists. He gave and example which I found confusing to say the least. So I rewrote the example in a way that...
1
by: jacuna | last post by:
variables declared in a block or in the parameter list of a function are assumed to be of storage class________ unless specified otherwise
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.