Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. $this->load->helper('directory');
  2. $this->load->helper('file');
  3. $files = directory_map('./uploads/', 1);
  4.  
  5. $test = [];
  6. if(!empty($files)) {
  7. foreach ($files as $f) {
  8. if (strpos($f, '/') === false && $f != 'index.php') {
  9. $file = $f;
  10. $explode = explode('_', substr($file, 0, -4));
  11. $user = $explode[0];
  12. $month = $explode[1];
  13. $year = $explode[2];
  14. $timestamp = strtotime($year . '-' . $month . '-15 00:00:00');
  15. $i = (isset($test[$year][$user])) ? count($test[$year][$user]) : 0;
  16.  
  17. $test[$year][$user][$i]['month'] = $this->months[intval(date('n', $timestamp))];
  18. $test[$year][$user][$i]['file'] = $file;
  19. $test[$year][$user][$i]['timestamp'] = $timestamp;
  20. }
  21. }
  22. }
  23.  
  24. var_dump($test);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement