[ create a new paste ] login | about

Link: http://codepad.org/6viL1peq    [ raw code | output | fork ]

PHP, pasted on Jan 7:
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
function adjustArray($myArray, $lineLimit = 3){
    $count = count($myArray);

    if ($count % $lineLimit != 0){
        for($i = 0; $i < $lineLimit - $count % $lineLimit; $i++)
            $myArray[] = "";
    }   

    return $myArray;

}
var_dump(adjustArray(array("", "he")));


Output:
1
2
3
4
5
6
7
8
array(3) {
  [0]=>
  string(0) ""
  [1]=>
  string(2) "he"
  [2]=>
  string(0) ""
}


Create a new paste based on this one


Comments: