Conditions | 6 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | function mask_document(string $document, string $chars, string $mask = '', int $index = 0): string |
||
17 | { |
||
18 | for ($i = 0; $i <= strlen($chars) - 1; $i++) { |
||
19 | if ($chars[$i] == '*' || $chars[$i] == '#') { |
||
20 | if (isset($document[$index])) { |
||
21 | $mask .= $document[$index++]; |
||
22 | } |
||
23 | } else { |
||
24 | if (isset($chars[$i])) { |
||
25 | $mask .= $chars[$i]; |
||
26 | } |
||
27 | } |
||
28 | } |
||
29 | |||
30 | return $mask; |
||
31 | } |
||
50 | } |