startsWith and endsWith methods in Laravel

The startsWith and endsWith methods check whether a string starts or ends with one or more substrings:

Str::startsWith('.htaccess', '.hta'); // Returns true
Str::endsWith('index.html', array('html', 'php')); // Returns true

Enjoyed this post? Share it!