Skip to content

Instantly share code, notes, and snippets.

@WaximeA
Created August 29, 2018 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WaximeA/ffddc58421cd984b05781707bc116860 to your computer and use it in GitHub Desktop.
Save WaximeA/ffddc58421cd984b05781707bc116860 to your computer and use it in GitHub Desktop.
Generate files
<?php
/** @var string $path */
$path = 'semaphores/';
echo '<h3>Semaphores files will be created in '.$path.' folder.</h3>';
echo '<h4>Creating files :</h4>';
for ($second = 0; $second < 60; $second++){
/** @var string $file */
$file = 'test_201808240710'.$second.'.csv.ok';
if ($second < 10){
/** @var string $file */
$file = 'test_2018082407100'.$second.'.csv.ok';
}
echo $file.'</br>';
/** @var string $realFile */
$realFile = $path.$file;
fopen($realFile, 'w');
/** @var $current */
$current = file_get_contents($realFile);
$current .= '2018-08-24 07:10:'.$second;
file_put_contents($realFile, $current);
}
echo '<h4>It\'s OK</h4>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment