# PHP5 extensions: using existing functionnames as method names

- Thread: https://externals.io/message/25654
- Original archive: https://news-web.php.net/php.internals/25654
- Started by danhen@email.de on 2006-09-13T09:35:16+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #25654 — danhen@email.de — 2006-09-13T09:35:16+00:00

URL: https://externals.io/message/25654#25654

...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.

Daniel

---

## #25659 — Pierre — 2006-09-13T11:50:07+00:00

URL: https://externals.io/message/25654#25659 · In reply to: #25654

On Wed, 13 Sep 2006 11:35:16 +0200
danhen@email.de wrote:

> ...Just forgot to CC...
> > […]
> 
> > […]
> 
> 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
