Re: PHP5 extensions: using existing functionnames as method names

From: Date: Wed, 13 Sep 2006 11:50:07 +0000
Subject: Re: PHP5 extensions: using existing functionnames as method names
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-25659@lists.php.net to get a copy of this message
On Wed, 13 Sep 2006 11:35:16 +0200 danhen@email.de wrote: > ...Just forgot to CC... > >you can use any function name as method name without a clash. you > >just cannot use language constructs that aren't real functions like > >"empty", "echo" or "require" as method names. > > >this question better belongs to php-general, btw. > > Sorry if I didn't made myself clear enough. I'm talking about > C-extensions. I've tried to implement the PHP_METHOD(class, xyz). It > compiles fine, but in runtime "PHP Warning: cannot redeclare xyz..." > will appaer. It is possible to name a method like an existing function, I'm not sure what you are doing exactly but it works here. When your class is called zip and you have a function called zip_open, it will conflict with the function name when you build against php < 5.2.0. It is fixed in 5.2 and a work around exists, see ext/zip for an example. -- Pierre

« previous php.internals (#25659) next »