3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(1,2,array(3)); $b = array(2,2,2,1); print_r(array_intersect($b, $a));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Array to string conversion in /in/WT0ie on line 6 Array ( [0] => 2 [1] => 2 [2] => 2 [3] => 1 )
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Array to string conversion in /in/WT0ie on line 6 Array ( [0] => 2 [1] => 2 [2] => 2 [3] => 1 )
Output for 5.3.0 - 5.3.29, 7.3.32 - 7.3.33, 7.4.26
Array ( [0] => 2 [1] => 2 [2] => 2 [3] => 1 )

preferences:
251.01 ms | 402 KiB | 345 Q