Builtin for checking if vec contains specified element
Let's say, I have a vec<int> containing a list of integers that may be non-continuous (due to element being removed from database). Example: $occupiedNumbers = vec[1, 2, 3, 5, 6, 8, 10, 11, 12, 13, 15, 16]; Now what I need is to check if this vec contains a given number, and if yes, increase it by 1 and repeat checking. $newItemNumber = count($occupiedNumbers); while (/* check if $occupiedNumbers contains $newItemNumber */) { $a++; } In vanilla PHP there is in_array() for this, but would that work for a vec? Also, there is a builtin HH\Vector::linearSearch() but it's meant to be used with vec'
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.