Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
42 | 3 | public static function getStringFromArraySeparatedByComma($array) |
|
43 | { |
||
44 | 3 | $ret = ""; |
|
45 | 3 | $i = 0; |
|
46 | 3 | $len = count($array); // to put "," to all items except the last |
|
47 | |||
48 | 3 | foreach ($array as $key => $value) { |
|
49 | 3 | $ret .= $value; |
|
50 | 3 | if ($i != $len - 1) { // not last |
|
51 | 1 | $ret .= ', '; |
|
52 | } |
||
53 | 3 | $i++; |
|
54 | } |
||
55 | |||
56 | 3 | return $ret; |
|
57 | } |
||
60 |