Skip to content

Instantly share code, notes, and snippets.

@ZAYEC77
Last active January 24, 2019 15:28
Show Gist options
  • Save ZAYEC77/6217f63d3b87a587e4c531c54326a866 to your computer and use it in GitHub Desktop.
Save ZAYEC77/6217f63d3b87a587e4c531c54326a866 to your computer and use it in GitHub Desktop.
<?php
function fixName($value) {
$value = mb_eregi_replace('й', 'й', $value);
$value = mb_eregi_replace('ё', 'ё', $value);
return $value;
}
function getDirs($path) {
return array_diff(scandir($path), array('..', '.'));
}
function mapFile($handle, $cb, $separator = '\n') {
while (!feof($handle)) {
//$buffer = fgets($handle);
$buffer = stream_get_line($fp, 65535, $separator);
yeild $cb($buffer);
}
fclose($handle);
}
$input = 'input.txt';
$output = 'output.txt';
$inputHandle = fopen($input, 'r');
$outputHandle = fopen($input, 'w');
fclose($inputHandle);
fclose($outputHandle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment