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
2009-12-08 01:43:15
Of course it's in the standard library. D'oh!
MiseryIndex
2009-12-08 01:45:52
One of the nicer features of PHP is that it has almost everything you will ever need.
MitMaro
2009-12-08 01:47:08
Hence the annoyed grunt. ;-) Still waiting to see if anyone knows if Xdebug can display constants though.
MiseryIndex
2009-12-08 01:48:36
Xdebug doesn't provide this functionality. No reason you couldn't use the Xdebug var_dump to display the constants though.
MitMaro
2009-12-08 01:56:01