diogo Posted December 31, 2012 Posted December 31, 2012 Just used the form $a->eq(-n) to choose the element that is before the last in an array ($a->eq(-2)) and it works, but it's not mentioned on the arrays page of the documentation http://processwire.com/api/arrays/ and, naturally, neither on the cheatsheet.
Soma Posted December 31, 2012 Posted December 31, 2012 It's somehow assumed, as the php equivalents you can also use -n, array_slice or substr etc.
diogo Posted December 31, 2012 Author Posted December 31, 2012 Some people are learning php while working with pw, I'm doing it myself. I think it would be better if things like this would be explicit on the documentation. 1
ryan Posted December 31, 2012 Posted December 31, 2012 New things get added too. Once 2.3 is out, I'm going to try and go through everything and track down what new stuff should be added to the docs and cheatsheet. I think eq() has been there since the beginning, though it's admittedly one I don't use often (easy to forget it's there).
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now