views:

115

answers:

2

I'm stepping through the source code of CodeIgniter with Xdebug in NetBeans and I'm looking for a way to see defined constants as they are defined. If it's not possible, are there any other ways to display all defined constants?

+3  A: 

Take a look at the get_defined_constants function. It will return an array of all the defined constants in the code up to the point of the function call. You can then use print_r to print out the array.

MitMaro
Of course it's in the standard library. D'oh!
MiseryIndex
One of the nicer features of PHP is that it has almost everything you will ever need.
MitMaro
Hence the annoyed grunt. ;-) Still waiting to see if anyone knows if Xdebug can display constants though.
MiseryIndex
Xdebug doesn't provide this functionality. No reason you couldn't use the Xdebug var_dump to display the constants though.
MitMaro
A: 

You probably want to adapt:

$arr = get_defined_vars();

wallyk