Advertisement
roysa99

phpself

Feb 1st, 2017
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2.  
  3. define('DT', '2017-02-01 17:25:43');
  4.  
  5. $self = file_get_contents(__FILE__);
  6.  
  7. $date = date('Y-m-d H:i:s');
  8.  
  9. echo "Current date: " . DT . ", updating to {$date}\n";
  10.  
  11. $self = preg_replace('/define\(\'DT\', \'.*?\'\)/', 'define(\'DT\', \'' . $date . '\')', $self);
  12.  
  13. #echo $self;
  14.  
  15. file_put_contents(__FILE__, $self);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement