How to get class constants with there value?

This is a discussion on How to get class constants with there value? within the PHP General forums, part of the PHP Programming Forums category; Hello there, I use PHP5, and i wanted to know if there is an option to extract class constants with ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-23-2007
Mathijs
 
Posts: n/a
Default How to get class constants with there value?

Hello there,

I use PHP5, and i wanted to know if there is an option to extract class
constants with there name and value without using Refelection.

Now i need to create a reflection of the class to get the info.

Is there something like get_class_variables for constants??

Thx in advanced.
Reply With Quote
  #2 (permalink)  
Old 03-23-2007
Mikey
 
Posts: n/a
Default Re: How to get class constants with there value?

Mathijs wrote:
> Hello there,
>
> I use PHP5, and i wanted to know if there is an option to extract class
> constants with there name and value without using Refelection.
>
> Now i need to create a reflection of the class to get the info.
>
> Is there something like get_class_variables for constants??
>
> Thx in advanced.


Read the first user contributed note for this page - I think that is
your answer...

http://uk3.php.net/manual/en/functio...class-vars.php

HTH,

Mikey
Reply With Quote
  #3 (permalink)  
Old 03-23-2007
Steve
 
Posts: n/a
Default Re: How to get class constants with there value?

Doesn't that destroy the entire reason for having variables within a class
in the first place? Why not set them as private and use accessors and
mutators to mess with their values? If you aren't going to use those, why
not just create global variables and functions? You basically lose your
entire reason for having a class if you allow scripts to just reach inside
of it and take whatever they want.


"Mathijs" <mathijs.van.veluw@smscity.com> wrote in message
news:86.97.02386.2E4A3064@pb1.pair.com...
> Hello there,
>
> I use PHP5, and i wanted to know if there is an option to extract class
> constants with there name and value without using Refelection.
>
> Now i need to create a reflection of the class to get the info.
>
> Is there something like get_class_variables for constants??
>
> Thx in advanced.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:55 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0