Fix Uncaught Error Call to undefined function str_starts_with()

Uncaught Error: Call to undefined function str_starts_with() Fix Solutions
PHP Thumbnail
if (!function_exists('str_starts_with')) {
  function str_starts_with($haystack, $needle, $case = true)
  {
    if ($case) {
      return strpos($haystack, $needle, 0) === 0;
    }
    return stripos($haystack, $needle, 0) === 0;
  }
}

if (!function_exists('str_ends_with')) {
  function str_ends_with($haystack, $needle, $case = true)
  {
    $expectedPosition = strlen($haystack) - strlen($needle);
    if ($case) {
      return strrpos($haystack, $needle, 0) === $expectedPosition;
    }
    return strripos($haystack, $needle, 0) === $expectedPosition;
  }
}

Comments

Popular posts from this blog

Install deb package via Termux

How to Make Blogger Safelink Converter v3

List of weapon buff materials, effects and how it can be durango wild lands