3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [1,2,2,3,3,3,4,4,4,4]; $b = [2,3,5]; var_dump( array_intersect($a, $b), // [2,2,3,3,3] array_intersect($b, $a) // [2,3] );

preferences:
42.63 ms | 405 KiB | 5 Q