function test_ends_with() { $this->assertTrue(Str::ends_with('wpdc', 'dc')); $this->assertTrue(wpdevsclub_ends_with('wpdc', 'wpdc')); $this->assertTrue(Str::ends_with('wpdc', array('dc'))); $this->assertFalse(Str::ends_with('wpdc', 'pd')); $this->assertFalse(wpdevsclub_ends_with('wpdc', array('wpd'))); $this->assertFalse(Str::ends_with('wpdc', '')); $this->assertFalse(Str::ends_with('7', ' 7')); }
/** * Determine if a given string ends with a given substring. * * @param string $haystack * @param string|array $needles * @return bool */ function wpdevsclub_ends_with($haystack, $needles) { return Str::ends_with($haystack, $needles); }