for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* ReportingCloud PHP SDK
*
* PHP SDK for ReportingCloud Web API. Authored and supported by Text Control GmbH.
* @link https://www.reporting.cloud to learn more about ReportingCloud
* @link https://git.io/Jejj2 for the canonical source repository
* @license https://git.io/Jejjr
* @copyright © 2022 Text Control GmbH
*/
namespace TxTextControl\ReportingCloud\Stdlib;
* Class StringUtils
* @package TxTextControl\ReportingCloud
* @author Jonathan Maron (@JonathanMaron)
class StringUtils extends AbstractStdlib
{
* Return true, if needle is at the beginning of haystack
* @param string $haystack
* @param string $needle
* @return bool
public static function startsWith(string $haystack, string $needle): bool
// Source: https://git.io/JnWmc
return 0 === strncmp($haystack, $needle, strlen($needle));
}
* Return true, if needle is at the end of haystack
public static function endsWith(string $haystack, string $needle): bool
// Source: https://git.io/JnWml
return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -strlen($needle)));