for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace Formularium;
// from https://github.com/illuminate/support/blob/master/Str.php
class StringUtil
{
/**
* Determine if a given string starts with a given substring.
*
* @param string $haystack
* @param string|string[] $needles
* @return bool
*/
public static function startsWith($haystack, $needles)
foreach ((array) $needles as $needle) {
if ((string) $needle !== '' && strncmp($haystack, $needle, strlen($needle)) === 0) {
return true;
}
return false;
* Determine if a given string ends with a given substring.
public static function endsWith($haystack, $needles)
if ($needle !== '' && substr($haystack, -strlen($needle)) === (string) $needle) {