Jump to content

array_search() for WireArray?


Robin S
 Share

Recommended Posts

Is there a WireArray equivalent of PHP's array_search() function? In other words, if I have a value and I want to know the key of that value (if any) for a given WireArray, how can I do that?

I checked the WireArray docs but didn't find any equivalent, which surprised me because array_search() is a pretty commonly used function.

Would the only way be to convert the WireArray to a plain PHP array with getArray()?

Link to comment
Share on other sites

Thanks @kixe!

Why is this method undocumented I wonder? I'd love to know the criteria by which a method makes it into the API docs or not.

I'd like to see all class methods documented. If the PhpDoc comments are already there (as they are in most cases) then where's the harm in making the information viewable in the API docs? @ryan?

Link to comment
Share on other sites

1 minute ago, kixe said:

Nevertheless, I mainly use the code itself as documentation.

I guess I should do the same. It's just that Google is so convenient. :-)

I can see some benefits in having some introductory documentation that skips over the details. The earlier documentation was a bit like that and it's still useful.

But for the v3 API Reference I think the more comprehensive the better. Having detailed and comprehensive documentation is not only useful to current users but it also boosts PW's credibility for potential users, particularly for experienced devs who I'm sure would find PW a pleasure to use and could make some valuable contributions to the community. The richness of the API is something we should show off rather than hide.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...