Skip to content

Instantly share code, notes, and snippets.

@belocer
Created January 26, 2019 14:56
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 belocer/a7e74643410c19727d97be0b7fe82628 to your computer and use it in GitHub Desktop.
Save belocer/a7e74643410c19727d97be0b7fe82628 to your computer and use it in GitHub Desktop.
Work File System .txt PHP
<?php
$dir = scandir("source");
$file = [];
for ($i = 2; $i < count($dir); $i++) {
$_arr = fopen("source/" .$dir[$i], "r");
array_push($file, file("source/" .$dir[$i]));
}
$arr = [];
$arr = call_user_func_array('array_merge', $file);
$arr = array_map('trim', $arr);
$arr_str = array_unique($arr, SORT_LOCALE_STRING);
$arr_str = implode("\r\n", $arr_str);
file_put_contents('result/result.txt', $arr_str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment