Thanks Sherif and all, for your answers.

So I will not rely on the order returned by get_class_vars (or
get_class_methods), instead adding suitable code (actually
roughly one additional line per class involved) to define my
desired ordering by hand.

If you're curious, the use case I was thinking of, arose when
implementing a logfile message formatting class hierarchy, where
subclasses represent individual logfiles with different pieces of
information that might be added to the logfile lines, in addition to the
base message - stuff like PHP_SELF, the calling user, memory usage etc.

I implement each of these different pieces as a separate trait with a
formatting function of a certain prefix, and imagined I could just use
the order of "use" statements in my subclasses, or as a proxy the method
order, to stably define the order in which the pieces will the show in
the logfile represented by that subclass.

Now, I add a static::$order array to each subclass, where I name the
pieces again (in addition to the use statements).

best regards
  Patrick




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to