Reserved PHP Function: list()?
I am having trouble having a method in a class called "list()". PHP gives me a parse error, and I have to name it something else. Why is this, and is there a way around it?
I am having trouble having a method in a class called "list()". PHP gives me a parse error, and I have to name it something else. Why is this, and is there a way around it?
Greg K posted this at 17:06 — 29th January 2009.
He has: 2,145 posts
Joined: Nov 2003
See http://us2.php.net/manual/en/reserved.keywords.php
If it is a method that will only be used by the class, then try an alternative like _list(), otherwise use a similar meaning or longer one:
describe()
listItems()
pr0gr4mm3r posted this at 17:34 — 29th January 2009.
He has: 1,502 posts
Joined: Sep 2006
Well that's a bummer. This class I'm writing is working with a proprietary desktop application, and I wanted to make the API calls match up with the methods. So much for that idea.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.