simple feature request :]

php.internals

Robert Janeczek

22 years ago
i was wondering if there would be much trouble with adding boolean trigger to get_class_vars ( string class_name) and get_object_vars ( object obj) which will tell this functions whether to return array with names and values or with names only. with default option set to returning names and values there will be no bc broken. or maybe there is somewhere a function that lists class/object variables names? rash

Sara Golemon

22 years ago
> i was wondering if there would be much trouble with adding boolean trigger > to > get_class_vars ( string class_name) and > get_object_vars ( object obj) > which will tell this functions whether to return array with names and
values
> or with names only. with default option set to returning names and values > there will be no bc broken. > > or maybe there is somewhere a function that lists class/object variables > names? >
Something like array_keys(get_class_vars($classname)) or array_keys(get_object_vars($object)) ?

Robert Janeczek

22 years ago
> Something like array_keys(get_class_vars($classname)) or > array_keys(get_object_vars($object)) ?
:) sure, but what i want to get is reading variable names without copying values. let`s say i have object with 2MB of text in it - using get_class[object]_vars would copy whole text to temporary array, wouldn`t it? or is there only reference operation inside? if reference only than i cancel my question :) but if threre is copying - my question remains - how do i get class variables names without reading their values? rash

Derick Rethans

22 years ago
On Thu, 4 Mar 2004, Robert Janeczek wrote:
> > Something like array_keys(get_class_vars($classname)) or > > array_keys(get_object_vars($object)) ? > > :) sure, but what i want to get is reading variable names without copying > values. let`s say i have object with 2MB of text in it - using > get_class[object]_vars would copy whole text to temporary array, wouldn`t > it?
No, it won't copy it, unless you modify elements in the returned array or the returned array itself. (And in the latter case only the array structure is copied, not the elements). regards, Derick