# get_defined_constants()

- Thread: https://externals.io/message/11792
- Original archive: https://news-web.php.net/php.internals/11792
- Started by Nathan on 2004-08-01T18:35:49+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #11792 — Nathan — 2004-08-01T18:35:49+00:00

URL: https://externals.io/message/11792#11792

Dear List,

i was using the get_defined_constants function the first time today and sadly for me i read in the man-pages that it displays _all_ defined constants. 

Wouldn't it make sense to implement a function like get_user_defined_constants which would only display those constants `define()`ed by the user during the development time? If it's not worth a function maybe an parameter would be nice, like 

// return an array of constants defined by the user using `define()`;
get_defined_constants(C_USER) 

// return an array with all defined constants 
get_defined_constants(C_ALL) 


This would also apply to the functions get_defined_functions and get_defined_vars. Maybe there is already a way to figure such things out, but i haven't found anything in the man-pages. 

I would be glad to know if something alike exists, or if not, why it wouldn't make sense.

Thanks in advance,
Nathan


PS: Please CC me, as i'm not on the list

---

## #12012 — Ron Korving — 2004-08-08T18:45:43+00:00

URL: https://externals.io/message/11792#12012 · In reply to: #11792

it's a nice idea, and personally, i would prefer a simple boolean parameter
instead of constants where there's only 2 possibilities anyway..

"Nathan" <nathan@hamevents.de> wrote in message
news:20040801203549.0187f752@sheytan...
> Dear List,
>
> i was using the get_defined_constants function the first time today and
sadly for me i read in the man-pages that it displays _all_ defined
constants.
>
> Wouldn't it make sense to implement a function like
get_user_defined_constants which would only display those constants
 `define()`ed by the user during the development time? If it's not worth a
function maybe an parameter would be nice, like
>
> // return an array of constants defined by the user using `define()`;
> get_defined_constants(C_USER)
>
> // return an array with all defined constants
> get_defined_constants(C_ALL)
>
>
> This would also apply to the functions get_defined_functions and
get_defined_vars. Maybe there is already a way to figure such things out,
but i haven't found anything in the man-pages.
>
> I would be glad to know if something alike exists, or if not, why it
wouldn't make sense.
>
> Thanks in advance,
> Nathan
>
>
> PS: Please CC me, as i'm not on the list

---

## #12015 — Michael Walter — 2004-08-08T19:15:44+00:00

URL: https://externals.io/message/11792#12015 · In reply to: #12012

The latter is much more readable, though.

Cheers,
Michael

Ron Korving wrote:
> it's a nice idea, and personally, i would prefer a simple boolean parameter
> instead of constants where there's only 2 possibilities anyway..
> 
> "Nathan" <nathan@hamevents.de> wrote in message
> news:20040801203549.0187f752@sheytan...
> 
> > […]
> 
> sadly for me i read in the man-pages that it displays _all_ defined
> constants.
> 
> > […]
> 
> get_user_defined_constants which would only display those constants
> `define()`ed by the user during the development time? If it's not worth a
> function maybe an parameter would be nice, like
> 
> > […]
> 
> get_defined_vars. Maybe there is already a way to figure such things out,
> but i haven't found anything in the man-pages.
> 
> > […]
> 
> wouldn't make sense.
> 
> > […]

---

## #12017 — Thomas Goyne — 2004-08-08T21:13:32+00:00

URL: https://externals.io/message/11792#12017 · In reply to: #12015

On Sun, 08 Aug 2004 21:15:44 +0200, Michael Walter <cm@leetspeak.org>  
wrote:

> The latter is much more readable, though.
>
> Cheers,
> Michael
>
> Ron Korving wrote:
> > […]

The bool method is used in numerous other places, and consistancy is good.

-- 

Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
