1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- use PHPUnit\Framework\TestCase;
- class TestPHPLan extends TestCase
- {
- public function testSlice()
- {
- $specs = ["red", "green", "blue", "yellow", "brown"];
- $count = count($specs);
- for ($length = 1; $length < $count; $length++)
- {
- $low = array_slice($specs,0,$length);
- $high = array_slice($specs,$length);
- }
- }
- public function testFS()
- {
- $str_ends_with = function (string $haystack, string $needle): bool
- {
- if ('' === $needle || $needle === $haystack) {
- return true;
- }
- if ('' === $haystack) {
- return false;
- }
- $needleLength = strlen($needle);
- return $needleLength <= strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
- };
- $a = $str_ends_with('huoshenguo','fs');
- $b = 1;
- }
- }
|