3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $entries = array( "111 555 465", "666 123 777", "000 999", ); $test = array(111, 465, 555, 666, 777); foreach ($entries as $key => $entry) { $plotsTotal1 = explode(' ', $entry); $plotsTotal2 = array_filter($plotsTotal1); $matches = array_intersect($test, $plotsTotal2); if (count($matches) > 0) { echo 'Entry ' . $key. ' contains ' . implode(',', $matches) . "\n"; } }
Output for 4.3.0 - 7.1.0
Entry 0 contains 111,465,555 Entry 1 contains 666,777