| Conditions | 4 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public static function isAnagram(string $s, string $t): bool |
||
| 10 | { |
||
| 11 | [$m, $n] = [strlen($s), strlen($t)]; |
||
| 12 | if ($m !== $n) { |
||
| 13 | return false; |
||
| 14 | } |
||
| 15 | $source = $target = []; |
||
| 16 | for ($i = 0; $i < $m; $i++) { |
||
| 17 | $source[] = $s[$i]; |
||
| 18 | } |
||
| 19 | for ($i = 0; $i < $n; $i++) { |
||
| 20 | $target[] = $t[$i]; |
||
| 21 | } |
||
| 22 | sort($source); |
||
| 23 | sort($target); |
||
| 24 | |||
| 25 | return $source === $target; |
||
| 26 | } |
||
| 54 |