Jump to content

PageArray: has or =


Robin S
 Share

Recommended Posts

$my_page_array = 1234

Don't know about performance, but with this code you would set the value of $my_page_array to 1234 which most likely would throw an error.

For comparison use

$my_page_array === 1234

If you have the $page object that you are searching for already, you can also pass that directly into the has() method like

$my_page_array->has($page)

instead of $my_page_array->has("id=1234")

  • Like 5
Link to comment
Share on other sites

Don't know about performance, but with this code you would set the value of $my_page_array to 1234 which most likely would throw an error.

You are right of course, don't know what I was thinking there...  :-[ 

So I think we can safely say that of the two, ->has() definitely performs better :biggrin:

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