|
@@ -19,18 +19,23 @@ class TestPHPLan extends TestCase
|
|
|
|
|
|
public function testFS()
|
|
|
{
|
|
|
- $isfs = function ($name)
|
|
|
+ $str_ends_with = function (string $haystack, string $needle): bool
|
|
|
{
|
|
|
- $names = [];
|
|
|
- if(in_array($name,$names)) {
|
|
|
+ if ('' === $needle || $needle === $haystack) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ if ('' === $haystack) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
+ $needleLength = strlen($needle);
|
|
|
|
|
|
-
|
|
|
+ return $needleLength <= strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
|
|
|
};
|
|
|
- $a = $isfs();
|
|
|
+
|
|
|
+ $a = $str_ends_with('huoshenguo','fs');
|
|
|
+ $b = 1;
|
|
|
}
|
|
|
|
|
|
}
|