मानक PHP तरह से परीक्षण करने के लिए है कि क्या एक स्ट्रिंग $str
सबस्ट्रिंग $test
के साथ समाप्त होता है:एक PHP स्ट्रिंग किसी अन्य स्ट्रिंग के साथ समाप्त होने का सबसे कुशल परीक्षण क्या है?
$endsWith = substr($str, -strlen($test)) == $test
इस सबसे तेज़ तरीका है?
समान: http://stackoverflow.com/questions/834303/php-startswith- और-endwith-functions – trante
आपको ['s ($ str) -> समाप्त हो सकता है ($ test)'] (https://github.com/delight-im/PHP-Str/blob/8fd0c608d5496d43adaa899642c1cce047e076dc/src/Str। PHP # L117) या ['s ($ str) -> endWithIgnoreCase ($ test)'] (https://github.com/delight-im/PHP-Str/blob/8fd0c608d5496d43adaa899642c1cce047e076dc/src/Str.php#L131) सहायक, जैसा कि [इस स्टैंडअलोन लाइब्रेरी] में पाया गया है (https://github.com/delight-im/PHP-Str)। – caw