Filtering with array functions [part 3]
Did you know that there are two ways to work with arrays?
In the previous episodes of this series dedicated to array functions in PHP, you saw the basics on how to create arrays and some fundamental functions.
Today you will go all in with filtering elements within arrays.
In fact, there are two distinct methods when working with arrays.
The first is looping through all the elements inside (even if you know you don't need them).
This is not a very fast method, as you have already understood this method is rather confusing and slow.
You'll probably have worked with arrays with tens or hundreds of elements,
not ideal isn't it?
The second method is very fast but it will make your life a lot easier.
This is the power of filtering!
Over the years PHP has grown so much in this respect and, to this day, it provides dozens of functions that filter array elements depending on the features you decide to use.
They range from the most standard using a single parameter, to incredibly customized using callbacks and more.
Unfortunately, not everyone is able to use them effectively.
From today you will become one.