TYPO3 CMS  TYPO3_6-2
StringUtility.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Core\Utility;
3 
22 
32  static public function isLastPartOfString($haystack, $needle) {
33  // Sanitize $haystack and $needle
34  if (is_object($haystack) || (string)$haystack != $haystack || strlen($haystack) < 1) {
35  throw new \InvalidArgumentException(
36  '$haystack can not be interpreted as string or has no length',
37  1347135544
38  );
39  }
40  if (is_object($needle) || (string)$needle != $needle || strlen($needle) < 1) {
41  throw new \InvalidArgumentException(
42  '$needle can not be interpreted as string or has no length',
43  1347135545
44  );
45  }
46  $stringLength = strlen($haystack);
47  $needleLength = strlen($needle);
48  return strrpos((string) $haystack, (string) $needle, 0) === $stringLength - $needleLength;
49  }
50 
51 }
static isLastPartOfString($haystack, $needle)