Neos\Flow\I18n\Utility::stringEndsWith PHP Method

stringEndsWith() public static method

Checks if $haystack string ends with $needle string.
public static stringEndsWith ( string $haystack, string $needle ) : boolean
$haystack string
$needle string
return boolean TRUE if $haystack ends with $needle
    public static function stringEndsWith($haystack, $needle)
    {
        if (substr($haystack, -strlen($needle)) === $needle) {
            return true;
        }
        return false;
    }

Usage Example

コード例 #1
0
 /**
  * @test
  * @dataProvider sampleHaystackStringsAndNeedleStrings
  */
 public function stringIsFoundAtEndingOfAnotherString($haystack, $needle, $comparison)
 {
     $expectedResult = $comparison === 'ending' || $comparison === 'both' ? true : false;
     $result = I18n\Utility::stringEndsWith($haystack, $needle);
     $this->assertEquals($expectedResult, $result);
 }
All Usage Examples Of Neos\Flow\I18n\Utility::stringEndsWith