Friday 15 June 2012

php - incrementing a date in a loop -


I did some research but I have not found any problems. I try to test a date in a loop to see if some files are present or not actually I would like to play some user twice in every session when they played the file, with their IP and date Was there. So we test in a loop, if any file exists with each date between this day.

I have some problems, I really do not know how to raise a date in PHP

I tried to do something like this

P>

  ** function aggregate case () {// starting der variable $ ip = $ _SERVER ["REMOTE_ADDR"]; $ Date_str = date ('D-M-Y'); $ Representative = "ip /"; If (! File_exists ($ representative)) {FOPN ($ representative, "W +"); } $ Fichier = $ ip $ Date_str '.text'; $ Parax = 7; $ I = 0; $ Date_jeu = 0; // test DL \\\ 'survival du feature while ($ i & lt; = $ periode) {list ($ d, $ m, $ y) = explosion (' - ', $ date_str); $ Date2 = Date ('D-M-Y', MkTM (0, 0, 0, $ m, $ d + 1, $ Y)); $ Date = date ($ date2, mktime (0, 0, 0, $ m, $ d + 1, $ y)); Var_dump ($ date); If (file_exists ($ rep. $ Ip. $ '.txt')) {$ var = 0; } Other {FOPN ($ Rep. IP. Date. '.t.T.', 'W +'); $ Var = 1; // Break 1; } $ I ++; }; Return $ Var;   

I am making a start in php.

Any help would be appreciated.

You want to use strontotype and continue to use $ date variables:

  // Set up the date list ($ d, $ m, $ Y) = explosion ('-', $ date_str); $ Date2 = Date ('D-M-Y', MKTEM (0, 0, 0, $ m, $ d, $ Y)); $ Date = date ($ date2, mktm (0, 0, 0, $ m, $ d, $ Y)); // test DL \ 'existence du fixture while ($ i & lt; = $ periode) {$ date = strtotime ("+ 1 day", strontem ($ date)); // 1 day previous date $ date2 = strtotime ("+ 1 day", strtotime ($ date)); // $ 1 day $ dated date last date ("Wi-M-D", $ date); Var_dump ($ date); If (file_exists ($ rep. $ Ip. $ '.txt')) {$ var = 0; } Other {FOPN ($ Rep. IP. Date. '.t.T.', 'W +'); $ Var = 1; // Break 1; } $ I ++; }; Return $ Var;    

No comments:

Post a Comment