Jump to content

Recommended Posts

Posted

There is a remove method for WireArray/PageArray that removes a single given item from the array. But how about removing all the items in one PageArray from another? So basically like PHP's array_diff for PageArray - any suggestions for this?

Posted

Thanks for the replies.

@elabx: Yeah, I'm already doing a similar workaround using the ->not method.

$page_array_1 = $pages->find(selector_1);
// do some stuff with $page_array_1
$page_array_2 = $pages->find(selector_2);
// do some stuff with $page_array_2
// then to subtract $page_array_1 from $page_array_2...
$page_array_2->not(selector_1);

But it seems wrong to have to use the same selector again when you already have the PageArray you want to remove. I figured there has to be a better way...

...and there is, but it's not in the docs or cheatsheet. Thanks BitPoet.

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
  • Recently Browsing   0 members

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