Edit report at http://bugs.php.net/bug.php?id=51855&edit=1

 ID:               51855
 User updated by:  a at b dot c dot de
 Reported by:      a at b dot c dot de
 Summary:          Optional tuning parameter for get_defined_functions
                   and get_defined_constants
 Status:           Open
 Type:             Feature/Change Request
 Package:          Unknown/Other Function
 Operating System: Irrelevant
 PHP Version:      5.3.2

 New Comment:

Oh, one other thing ... the optional parameter to
get_defined_constants() would be of type mixed: give it true and it
behaves as it does currently, give it a string and it will restrict its
results to the extension with the given name.


Previous Comments:
------------------------------------------------------------------------
[2010-05-19 02:02:51] a at b dot c dot de

Description:
------------
get_defined_constants() offers an optional parameter which, when passed
true, categorises the constants by extension.



get_defined_functions() returns a list of function names categorised by
whether they are "user" or "internal".



Both could benefit from being able to specify an actual category,
instead of just that the returned list be categorised. For example,
get_defined_functions('internal') would return a one-dimensional
numerically-indexed array of internally-defined functions.



It's mainly for convenience: avoiding the extra variable, and depending
on the internals some work collating the data.



Since the list of extensions is so variable from configuration to
configuration, it would be infeasible to
define("DEFINED_CONSTANTS_PCRE", "pcre") and so forth.



If the syntax engine could be convinced then this suggestion would be
redundant, since it could then be achieved as
get_defined_functions()['internal'].

Test script:
---------------
print_r(get_defined_functions('internal'));



Equivalent to:



$functions = get_defined_functions();

print_r($functions['internal']);



Expected result:
----------------
Array(

            [0] => zend_version

            [1] => func_num_args

            [2] => func_get_arg

            [3] => func_get_args

            [4] => strlen

            ....

)

Actual result:
--------------
A Warning is triggered stating that get_defined_functions() expects
exactly 0 parameters, not the 1 that it was given. print_r() outputs
null.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51855&edit=1

Reply via email to