Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
53 | function altPersistence(int $num): int |
||
54 | { |
||
55 | // Ensure that $num is an integer |
||
56 | $num = (int)$num; |
||
57 | $splitNum = str_split($num); |
||
58 | if (true===$splitNum) { |
||
59 | return 0; |
||
60 | } |
||
61 | $count = 0; |
||
62 | while ($num > 9) { |
||
63 | $num = array_product($splitNum); |
||
64 | $count++; |
||
65 | } |
||
66 | |||
67 | return $count; |
||
68 | } |
||
69 |