/** * Test that endsWith() returns true if the end of the string matches the needle. */ public function testEndsWith() { $this->assertTrue(String::endsWith($this->string, 'work')); $this->assertFalse(String::endsWith($this->string, 'works')); // case-insensitive $this->assertTrue(String::endsWith($this->string, 'WORK', false)); $this->assertFalse(String::endsWith($this->string, 'WORKS', false)); }
function str_ends_with($string, $needle, $strict = true) { return String::endsWith($string, $needle, $strict); }