<?phpnamespace App\Alis;// Port of alis/src/utils.c (MIT, Olivier Huguenot, Vadim Kindl).// C strings that are not in Alis::$mem are PHP strings: the in-place functions return the new string.function strlower(string $str): string{ return strtolower($str);}/** C: returns a pointer into haystack or NULL -> the PHP substring from the match, or null. */function stristr(string $haystack, string $needle): ?string{ // for ( ; *haystack; haystack++) if (!strncasecmp(haystack, needle, len)) return haystack; $end = strpos($haystack, "\0"); if ($end !== false) { $haystack = substr($haystack, 0, $end); } if ($haystack === '') { return null; } $p = stripos($haystack, $needle); return $p === false ? null : substr($haystack, $p);}function strupper(string $str): string{ return strtoupper($str);}/** C: haystack is in Alis::$mem; returns the offset of the first match ending before length, or null (NULL). */function strarr(int $haystack, string $needle, int $length): ?int{ if ($length <= 0 || $needle === '') { return null; } $p = strpos(substr(Alis::$mem, $haystack, $length), $needle); return $p === false ? null : $haystack + $p;}function is_host_le(): int{ return 1; // the PHP host is "little endian" (see porting.md)}