Add get_object_constants and get_class_constants

From: Date: Tue, 26 Feb 2013 15:19:40 +0000
Subject: Add get_object_constants and get_class_constants
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hello All,

Before drafting an RFC I would like to gauge interest in adding:
get_object_constants and get_class_constants

Currently this can only be done through ReflectionClass which is far slower
than retrieving them directly from the constants table.  Some simple
timings show that through reflection retrieving these values is 2-3 times
slower than providing a quick access function for retrieval.

This also fits nicely amongst the current stack of:
get_object_vars, get_class_vars and get_class_methods

These functions are commonly asked about on areas such as StackOverflow (
http://stackoverflow.com/questions/956401/can-i-get-consts-defined-on-a-php-class)
amongst other places on the net.

I have already drafted up a PR with the changes and supplemental data:
https://github.com/php/php-src/pull/292

Regards,

Mike


Thread (16 messages)

« previous php.internals (#66245) next »