in_array multiple values

Run Settings
LanguagePHP
Language Version
Run Command
<?php function in_array_any($needles, $haystack) { return (bool)array_intersect($needles, $haystack); } $is3or9 = in_array_any( array(3,9), array(5,8,3,1,2) ); $is4or9 = in_array_any( array(4,9), array(5,8,3,1,2) ); $is3or9str = in_array_any( array('3', '9'), array(5,8,'3',1,2) ); $is3or9strAsInt = in_array_any( array('3', '9'), array(5,8,3,1,2) ); $is3or9intAsStr = in_array_any( array(3, 9), array(5,8,'3',1,2) ); $isThreeOrNine = in_array_any( array('three', 'nine'), array( 'three', 'seven', 'eight' ) ); echo 'Is 3 or 9 present: ' . sprintf('%s', $is3or9 ? "Yes" : "No"); // true, since 3 is present echo "\n"; echo 'Is 4 or 9 present: ' . sprintf('%s', $is4or9 ? "Yes" : "No"); // false, neither 4 nor 9 is present echo "\n"; echo "\n"; echo 'Is 3 or 9 (string) present: ' . sprintf('%s', $is3or9str ? "Yes" : "No"); // true, since 3 is present echo "\n"; echo 'Is 3 or 9 (as string) present (as int): ' . sprintf('%s', $is3or9strAsInt ? "Yes" : "No"); // true, since 3 is present echo "\n"; echo 'Is 3 or 9 (as int) present (as string): ' . sprintf('%s', $is3or9intAsStr ? "Yes" : "No"); // true, since 3 is present echo "\n"; echo 'Is Three or Nine present (as string): ' . sprintf('%s', $isThreeOrNine ? "Yes" : "No"); // true, since 3 is present
Editor Settings
Theme
Key bindings
Full width
Lines