Re: [PHP4BETA] passing a method to usort
| From: | Peter Kovacs | Date: | Tue, 29 Feb 2000 22:25:46 +0000 |
| Subject: | Re: [PHP4BETA] passing a method to usort | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11214@lists.php.net to get a copy of this message | ||
Personally I think this would be a worthwhile addition, that way you could
enclose say, an xml parser, inside a class. Right now I tend to use a
pseudo-class of mangled function names and global variables, not quite as
clean as I would like.
Peter
On Tue, 29 Feb 2000, Stig Bakken wrote:
> chagenbu@wso.williams.edu wrote:
> >
> > Quoting Stig Bakken <Stig.Bakken@fast.no>:
> >
> > > It is the Zend compiler that recognizes "::" (as opposed to the
> > > executor), so it's no wonder your example doesn't work. We could patch
> > > call_user_function{,_ex} to look for "::" in the function name though.
> >
> > That would be good. It doesn't address the issue of being able to pass an
> > _object_ method to usort() and similar functions, though - being able to pass an
> > instance of a class, so that class member variables can be referred to from
> > within the sort function... Any chance of that being possible?
>
> As far as I can see, that would require either a new data type or using
> a user-defined construct like array($object, "method").
>
> - Stig
>
--------------------------------------------------
Peter D. Kovacs KnowPost.com LLC
Pb Engineer peter@knowpost.com
--------------------------------------------------