array_intersect reference
20 February 2024 (Updated 20 February 2024)
How does it work?
array_intersect()
returns an array containing all the values in the first array that are also present in all the other arrays.
The below code:
Will output:
Because only "John"
and "Alice"
are present in all the other arrays ($finalists2020
, $finalists2021
, and $finalists2022
).
Tagged:
PHP
Thanks for your comment . Once it's approved, it will appear here.
Leave a comment