Set value

@param mixed $needleKey
@param mixed $needleValue
@param array $haystack
550576
public static function recursivelySetValue($needleKey, $needleValue,
                                               array &$haystack)
    {
        foreach ($haystack as $key => &$value) {
            if (isset($haystack[$needleKey])) {
                $haystack[$needleKey] = $needleValue;
            }

            if (is_array($value)) {
                self::recursivelySetValue($needleKey, $needleValue, $value);
            }
        }
    }
290754
public static function startsWith( $haystack, $needles )
	{
		if ( is_array( $haystack ) )
			throw new FrameworkException( "\$haystack must be a string!" );

		foreach ( (array) $needles as $needle )
			if ( $needle != '' && mb_strpos( $haystack, $needle ) === 0 )
				return true;

		return false;
	}
982161
public function startswith(string $haystack, string $needle) : bool
    {
        return (substr($haystack, 0, strlen($needle)) === $needle);
    }
913952
public static function endsWith(
        string $haystack,
        string $needle,
        $caseSensitive = true
    ) : bool {
        $needleLength = strlen($needle);
        $cmp = substr_compare(
            $haystack,
            $needle,
            -($needleLength),
            $needleLength,
            !$caseSensitive
        );

        return $cmp === 0;
    }
1003507
public static function contains(string $haystack, string $needle, int $offset = 0): bool
    {
        return self::strpos($haystack, $needle, $offset) !== false;
    }
1071991
function (needle, haystack, strict) {

            var found = false;

            strict = !!strict;

            $this.each(haystack, function (key) {
                /* jshint -W116 */
                if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
                    found = true;
                    return false;
                }
                /* jshint +W116 */
            });

            return found;
        }
1143622
public function starts_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}

		return strncmp( $haystack, $needle, strlen( $needle ) ) === 0;
	}
988705
public static function inArray($needle, $haystack, $strict = NULL)
	{
		return static::is_array($haystack) && in_array($needle, $haystack, $strict);
	}
1344326
private function index_of($haystack, $needle, $offset = 0)
    {
        $index = strpos($haystack, $needle, $offset);

        return ($index !== FALSE) ? $index : -1;
    }
975820
public static function arraySearchGetValue($needle, array $haystack)
    {
        $lcNeedle = strtolower($needle);

        foreach ($haystack as $value) {
            if ($lcNeedle == strtolower($value)) {
                return $value;
            }
        }

        return null;
    }
680531
public static function startsWith(string $haystack, string $needle) : bool
    {
        return !strncmp($haystack, $needle, strlen($needle));
    }
1013213
protected function stringHasStatement( $haystack, $needle ) {
		$pattern = '~^\s*(' . preg_quote( $needle, '~' ) . ')\s*$~m';
		return (bool) preg_match( $pattern, $haystack );
	}
197758
private function removeEmptyValues(array $haystack)
    {
        foreach ($haystack as $key => $value) {
            if (is_array($value)) {
                $haystack[$key] = $this->removeEmptyValues($value);
            }
            // remove empty values value value is NULL or an empty string ''
            if ($value === null || $value == '') {
                unset($haystack[$key]);
            }
        }
        
        return $haystack;
    }
697528
public static function startsWith($haystack, $needle, $case_sensitive = true)
    {
        $status = false;

        $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos';

        foreach ((array)$needle as $each_needle) {
            $status = $each_needle === '' || $compare_func($haystack, $each_needle) === 0;
            if ($status) {
                break;
            }
        }

        return $status;
    }
10014
public static function indexOf(string $haystack, string $needle, int $offset = 0): int
    {
        $pos = self::strpos($haystack, $needle, $offset);
        return is_int($pos) ? $pos : -1;
    }
569278
public static function array_ikey_exists($needle, $haystack) {
		if (! \is_array($haystack) || ! \count($haystack)) {
			return false;
		}
		$haystack = \array_keys($haystack);

		return (false !== static::array_isearch($needle, $haystack));
	}
968707
private function getValueFromArray($needle, $haystack)
    {
        if (!is_array($haystack) || !isset($haystack[$needle])) {
            return null;
        }

        return $haystack[$needle];
    }