public function endsWith($haystack, $needle) { return $needle == substr($haystack, strlen($haystack) - strlen($needle)); }