for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: lenovo
* Date: 6/15/2018
* Time: 11:18 AM
*/
namespace TimSDK\Support;
class Str
{
* Determine if a given string starts with a given substring.
*
* @param string $haystack
* @param string|array $needles
* @return bool
public static function startsWith($haystack, $needles)
foreach ((array) $needles as $needle) {
if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) {
return true;
}
return false;
* Determine if a given string ends with a given substring.
public static function endsWith($haystack, $needles)
if (substr($haystack, -strlen($needle)) === (string) $needle) {