Same name in other branches
  1. 8.x-1.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::startswith()

Helper function to know if a substring start a string.

Used internally and in help page (so should be public).

Paramètres

string $hay: The string where we look for.

string $needle: The string to look for.

Return value

bool If condition is valid.

1 call to ExifPHPExtension::startswith()
ExifPHPExtension::reformat dans src/ExifPHPExtension.php
Helper function to reformat fields where required.

Fichier

src/ExifPHPExtension.php, line 517

Classe

ExifPHPExtension
Class ExifPHPExtension Parser implementation base d on PHP Exif extension.

Namespace

Drupal\exif

Code

public static function startswith($hay, $needle) : bool {
    if (is_null($hay) || is_null($needle)) {
        return FALSE;
    }
    elseif (is_callable('str_starts_with')) {
        return str_starts_with($hay, $needle);
    }
    else {
        return substr($hay, 0, strlen($needle)) === $needle;
    }
}