Connecting Tech Pros Worldwide Help | Site Map

List all declared variables

 
LinkBack Thread Tools Search this Thread
  #1  
Old April 11th, 2007, 02:45 PM
Tyno Gendo
Guest
 
Posts: n/a
Default 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.

  #2  
Old April 11th, 2007, 02:55 PM
mickysoft.org@gmail.com
Guest
 
Posts: n/a
Default Re: List all declared variables

On Apr 11, 5:38 pm, Tyno Gendo <you@localhostwrote:
Quote:
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.

  #3  
Old April 11th, 2007, 03:05 PM
Tyno Gendo
Guest
 
Posts: n/a
Default Re: List all declared variables

mickysoft.org@gmail.com wrote:
Quote:
On Apr 11, 5:38 pm, Tyno Gendo <you@localhostwrote:
Quote:
>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 :-)
  #4  
Old April 12th, 2007, 07:05 AM
Martin Mandl - m2m tech support
Guest
 
Posts: n/a
Default Re: List all declared variables

On Apr 11, 4:58 pm, Tyno Gendo <you@localhostwrote:
Quote:
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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.