3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Helper { public static $skip = ['ENI', 'JFK/EDW']; } var_dump(\array_intersect(\explode('-', 'SYD-SFO-LAX'), Helper::$skip)); var_dump(\array_intersect(\explode('-', 'SYD-SFO-ENI'), Helper::$skip)); var_dump(\array_intersect(\explode('-', 'SYD-SFO-ENI-JFK/EDW'), ['ENI'])); var_dump(\array_intersect(\explode('-', 'SYD-SFO-JFK/EDW'), ['JFK/EDW'])); var_dump(\array_intersect(\explode('-', 'SYD-SFO-ENI-JFK/EDW'), Helper::$skip)); var_dump(\array_intersect(\explode('-', 'SYD-SFO-JFK/EDW'), Helper::$skip));
based on MEkgH
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0rc3
array(0) { } array(1) { [2]=> string(3) "ENI" } array(1) { [2]=> string(3) "ENI" } array(1) { [2]=> string(7) "JFK/EDW" } array(2) { [2]=> string(3) "ENI" [3]=> string(7) "JFK/EDW" } array(1) { [2]=> string(7) "JFK/EDW" }