Can we make str_(starts|ends)_with variadic? PR: https://github.com/php/php-src/pull/18825 Code like ```php if (str_starts_with($url, "http://") || str_starts_with($url, "https://")) { // url } if (str_ends_with($filename, ".pdf") || str_ends_with($filename, ".doc") || str_ends_with($filename, ".docx")) { // document } $isValidExtension = false; foreach ($validExtensions as $needle) { if (str_ends_with($str, $needle)) { $isValidExtension = true; break; } } if ($isValidExtension) { // valid extension } ``` could then be replaced with ``` if (str_starts_with($url, "http://", "https://")) { // url } if (str_ends_with($filename, ".pdf", ".doc", ".docx")) { // document } if(str_ends_with($str, ...$validExtensions){ // valid extension } ```
Fwiw Python support str.endswith((".pdf", ".doc", ".docx"))