for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpZip\Util;
/**
* String Util.
*
* @internal
*/
final class StringUtil
{
* @param string $haystack
* @param string $needle
* @return bool
public static function startsWith($haystack, $needle)
return $needle === '' || strrpos($haystack, $needle, -\strlen($haystack)) !== false;
}
public static function endsWith($haystack, $needle)
return $needle === '' || (($temp = \strlen($haystack) - \strlen($needle)) >= 0
&& strpos($haystack, $needle, $temp) !== false);