substr() публичный Метод

This implementation follows the JavaScript specification for "substr". Examples:: String.substr('Hello, World!', 7, 5) == 'World' String.substr('Hello, World!', 7) == 'World!' String.substr('Hello, World!', -6) == 'World!'
public substr ( string $string, integer $start, integer $length = null ) : string
$string string A string
$start integer Start offset
$length integer Maximum length of the substring that is returned
Результат string The substring
 /**
  * @test
  * @dataProvider substrExamples
  */
 public function substrWorks($string, $start, $length, $expected)
 {
     $helper = new StringHelper();
     $result = $helper->substr($string, $start, $length);
     $this->assertSame($expected, $result);
 }