The main point between foreach and array_map is that array_map involve a function call. That's why I chose to make a comparison on them. To understand if the function call has an impact.
OK, but test something else than search functions is irrelevant because in_array, array_filter, ... are implemented different than array_map and results are not comparable.
For example array_column is faster than foreach implementation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Why don't you benchmark all kinds of mentioned search methods?
The main point between
foreach
andarray_map
is thatarray_map
involve a function call. That's why I chose to make a comparison on them. To understand if the function call has an impact.OK, but test something else than search functions is irrelevant because in_array, array_filter, ... are implemented different than array_map and results are not comparable.
For example array_column is faster than foreach implementation.