BetterGen/src/Ad5001/BetterGen/utils/CommonUtils.php

29 lines
1.1 KiB
PHP

<?php
/**
* ____ __ __ ____
* /\ _`\ /\ \__ /\ \__ /\ _`\
* \ \ \L\ \ __ \ \ ,_\\ \ ,_\ __ _ __ \ \ \L\_\ __ ___
* \ \ _ <' /'__`\\ \ \/ \ \ \/ /'__`\/\`'__\\ \ \L_L /'__`\ /' _ `\
* \ \ \L\ \/\ __/ \ \ \_ \ \ \_ /\ __/\ \ \/ \ \ \/, \/\ __/ /\ \/\ \
* \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\ \ \____/\ \____\\ \_\ \_\
* \/___/ \/____/ \/__/ \/__/ \/____/ \/_/ \/___/ \/____/ \/_/\/_/
* Tomorrow's pocketmine generator.
* @author Ad5001
* @link https://github.com/Ad5001/BetterGen
*/
namespace Ad5001\BetterGen\utils;
# Common utils under no namespace made for a specific usage
class CommonUtils {
/**
* Searches case insensitively array $haystack for $needle.
* src: http://php.net/manual/en/function.in-array.php#89256
* @param mixed $needle
* @param array $haystack
* @return bool
*/
static function in_arrayi($needle, array $haystack) :bool {
return in_array(strtolower($needle), array_map('strtolower', $haystack));
}
}