fork(1) download
  1. <?php
  2.  
  3. $array_do_banco = array('01', '03', '04', '06', '11');
  4. $array_saida = array();
  5.  
  6. for($i=1; $i<13; $i++){
  7. if(in_array($i, $array_do_banco)){
  8. $matches = array_keys($array_do_banco, $i);
  9. $array_saida[$i-1] = $array_do_banco[$matches[0]];
  10. }else{
  11. $array_saida[$i-1] = str_pad($i , 2 , '0' , STR_PAD_LEFT);
  12. }
  13. }
  14.  
  15. var_dump($array_saida);
Success #stdin #stdout 0.02s 23584KB
stdin
Standard input is empty
stdout
array(12) {
  [0]=>
  string(2) "01"
  [1]=>
  string(2) "02"
  [2]=>
  string(2) "03"
  [3]=>
  string(2) "04"
  [4]=>
  string(2) "05"
  [5]=>
  string(2) "06"
  [6]=>
  string(2) "07"
  [7]=>
  string(2) "08"
  [8]=>
  string(2) "09"
  [9]=>
  string(2) "10"
  [10]=>
  string(2) "11"
  [11]=>
  string(2) "12"
}