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) }