protected function startsWith($haystack, $needle) { // search backwards starting from haystack length characters from the end return $needle === '' || strrpos($haystack, $needle, -strlen($haystack)) !== false; }