Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Author: Peter Dragicevic [peter-91@hotmail.de]
- * Authors-Website: http://petschko.org/
- * Licence: http://creativecommons.org/licenses/by-sa/4.0/
- * Date: 28.07.2015
- * Time: 09:36
- */
- /**
- * @param mixed $subject - needle
- * @param array $array - haystack
- * @param bool $deep_search - search subarrays too
- * @return bool - true if found
- */
- function is_in_array($subject, $array, $deep_search = false) {
- if(! $subject)
- return false;
- foreach($array as $string) {
- if(is_array($string) && $deep_search)
- if(is_in_array($subject, $string, true))
- return true;
- if($string == $subject)
- return true;
- }
- return false;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement