Il modo standard di PHP per verificare se una stringa $str
termina con una stringa $test
è:Qual è il test più efficiente se una stringa PHP termina con un'altra stringa?
$endsWith = substr($str, -strlen($test)) == $test
È questo il modo più veloce?
analogo: http://stackoverflow.com/questions/834303/php-startswith- and-endswith-functions – trante
Potresti trovare ['s ($ str) -> endsWith ($ test)'] (https://github.com/delight-im/PHP-Str/blob/8fd0c608d5496d43adaa899642c1cce047e076dc/src/Str. php # L117) o ['s ($ str) -> endsWithIgnoreCase ($ test)'] (https://github.com/delight-im/PHP-Str/blob/8fd0c608d5496d43adaa899642c1cce047e076dc/src/Str.php#L131) utile, come trovato in [questa libreria standalone] (https://github.com/delight-im/PHP-Str). – caw