[ create a new paste ] login | about

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

PHP, pasted on Apr 21:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

function getFileName($unixTime) {
    return 'abcd_' . date('Y_m_j', $unixTime) . '.txt';
} 

$files = array();

foreach(range(0, 6) as $dayOffset) {

   $files[] = getFileName(strtotime('-' . $dayOffset . ' day'));
}

var_dump($files);


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
array(7) {
  [0]=>
  string(19) "abcd_2011_04_21.txt"
  [1]=>
  string(19) "abcd_2011_04_20.txt"
  [2]=>
  string(19) "abcd_2011_04_19.txt"
  [3]=>
  string(19) "abcd_2011_04_18.txt"
  [4]=>
  string(19) "abcd_2011_04_17.txt"
  [5]=>
  string(19) "abcd_2011_04_16.txt"
  [6]=>
  string(19) "abcd_2011_04_15.txt"
}


Create a new paste based on this one


Comments: