Troque strpos e substr por str_contains, str_starts_with e str_ends_with no PHP 8, com o polyfill para quem ainda mantém servidor…